Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
495fa7cb
Commit
495fa7cb
authored
Apr 07, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StatRed: finished multivariate (question 21).
parent
c35ec4b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
18 deletions
+8
-18
statred/ass1/q21-multivariate.py
statred/ass1/q21-multivariate.py
+8
-18
No files found.
statred/ass1/q21-multivariate.py
View file @
495fa7cb
from
pylab
import
array
,
eig
,
diagflat
,
dot
,
sqrt
,
randn
,
tile
from
pylab
import
plot
,
axis
,
show
,
figure
,
clf
from
pylab
import
array
,
eig
,
diagflat
,
dot
,
sqrt
,
randn
,
tile
,
\
plot
,
sub
plot
,
axis
,
show
,
figure
,
clf
mean
=
array
([[
3
],
[
4
],
...
...
@@ -15,7 +15,7 @@ cov = array(
samples
=
1000
vector_size
=
4
figure
(
1
)
figure
(
1
6
)
clf
()
d
,
U
=
eig
(
cov
)
...
...
@@ -24,21 +24,11 @@ A = dot(U, sqrt(L))
X
=
randn
(
vector_size
,
samples
)
Y
=
dot
(
A
,
X
)
+
tile
(
mean
,
samples
)
#import matplotlib.pyplot as plt
for
i
in
range
(
4
):
for
j
in
range
(
4
):
for
i
in
range
(
1
,
5
):
for
j
in
range
(
1
,
5
):
if
i
!=
j
:
plot
(
Y
[
i
],
Y
[
j
],
'x'
)
subplot
(
4
,
4
,
i
+
(
j
-
1
)
*
4
)
plot
(
Y
[
i
-
1
],
Y
[
j
-
1
],
'x'
)
axis
(
'equal'
)
axis
(
'equal'
)
#plt.plot(x,y,'x');
#plt.axis('equal');
#plt.show()
show
()
#import numpy as np
#x,y = np.random.multivariate_normal(mean, cov, 5000).T
#print 'x:', x
#print 'y:', y
#plt.plot(x,y,'x'); plt.axis('equal'); plt.show()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment