Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nmm_2020_site
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Erik Strand
nmm_2020_site
Commits
0c1635ea
Commit
0c1635ea
authored
5 years ago
by
Erik Strand
Browse files
Options
Downloads
Patches
Plain Diff
Partially answer 12.1
parent
1f02bb00
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
_code/pset_07/cpp/svd.cpp
+2
-2
2 additions, 2 deletions
_code/pset_07/cpp/svd.cpp
_psets/07.md
+13
-0
13 additions, 0 deletions
_psets/07.md
with
15 additions
and
2 deletions
_code/pset_07/cpp/svd.cpp
+
2
−
2
View file @
0c1635ea
...
@@ -47,8 +47,8 @@ int main() {
...
@@ -47,8 +47,8 @@ int main() {
Eigen
::
MatrixXd
mat
(
n_samples
,
2
);
Eigen
::
MatrixXd
mat
(
n_samples
,
2
);
for
(
uint32_t
i
=
0
;
i
<
n_samples
;
++
i
)
{
for
(
uint32_t
i
=
0
;
i
<
n_samples
;
++
i
)
{
mat
(
i
,
0
)
=
samples
[
i
]
;
mat
(
i
,
0
)
=
1
;
mat
(
i
,
1
)
=
1
;
mat
(
i
,
1
)
=
samples
[
i
]
;
}
}
// Need at least ThinU and ThinV to use mat_svd.solve.
// Need at least ThinU and ThinV to use mat_svd.solve.
...
...
This diff is collapsed.
Click to expand it.
_psets/07.md
+
13
−
0
View file @
0c1635ea
...
@@ -2,6 +2,19 @@
...
@@ -2,6 +2,19 @@
title
:
Problem Set 7 (Function Fitting)
title
:
Problem Set 7 (Function Fitting)
---
---
## 1
Generate 100 points $$x$$ uniformly distributed between 0 and 1, and let $$y = 2 + 3x +
\z
eta$$,
where $$
\z
eta$$ is a Gaussian random variable with a standard deviation of 0.5. Use an SVD to fit
$$y = a + bx$$ to this data set, finding $$a$$ and $$b$$. Evaluate the errors in $$a$$ and $$b$$
using equation (12.34), by bootstrapping to generate 100 datasets, and from fitting an ensemble of
100 independent data sets.
I used
[
Eigen
](
http://eigen.tuxfamily.org/index.php?title=Main_Page
)
to compute the SVD (in C++).
My code is
[
here
](
https://gitlab.cba.mit.edu/erik/nmm_2020_site/-/tree/master/_code/pset_07/cpp/svd.cpp
)
. I
found $$a = 2.10697$$ and $$b = 2.91616$$.
## 3
## 3
{:.question}
{:.question}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment