27 lines
606 B
Python
27 lines
606 B
Python
|
#!/usr/bin/env python
|
||
|
|
||
|
from pylab import *
|
||
|
import sys
|
||
|
|
||
|
w = loadtxt(sys.stdin, max_rows=2)
|
||
|
cut = float(input())
|
||
|
|
||
|
n, m, d = map(int, input().split())
|
||
|
data = loadtxt(sys.stdin).reshape(n + m, d)
|
||
|
signal, noise = data[:n].T, data[n:].T
|
||
|
|
||
|
figure()
|
||
|
scatter(*signal, c='xkcd:grey blue', label='signal')
|
||
|
scatter(*noise, c='xkcd:baby blue', label='noise')
|
||
|
scatter(*(cut * w/np.dot(w,w)), c='red')
|
||
|
arrow(*(-abs(w)), *4*abs(w))
|
||
|
legend()
|
||
|
|
||
|
figure()
|
||
|
sig_proj = np.dot(w, signal)
|
||
|
noise_proj = np.dot(w, noise)
|
||
|
hist(sig_proj, color='xkcd:grey blue')
|
||
|
hist(noise_proj, color='xkcd:baby blue')
|
||
|
axvline(cut, c='r')
|
||
|
show()
|