Skip to content

Commit

Permalink
Minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sigvaldm committed Mar 18, 2022
1 parent 05917b1 commit 4151a4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions localreg/rbfnet.py
Expand Up @@ -254,13 +254,9 @@ def compute_centers(self, input, num, random_state=None):
inp_ = inp
was_complex = False

print(inp)
print(inp_)

clustering = KMeans(n_clusters=num, random_state=random_state).fit(inp_)

centers = clustering.cluster_centers_
print(centers)

if was_complex:
centers = centers[:,:n_indeps]+1j*centers[:,n_indeps:]
Expand Down
6 changes: 3 additions & 3 deletions test/test_rbf.py
Expand Up @@ -211,13 +211,13 @@ def test_keep_aspect():
def test_complex_input():
net = RBFnet()
input = np.array([[1+1j], [1-1j], [-1-1j], [-1+1j]])
output = np.real(x)+np.imag(x)
output = np.real(input)+np.imag(input)
net.train(input, output, num=3)
assert np.allclose(output, net.predict(input))
assert np.allclose(output, net.predict(input), atol=1e-5)

def test_complex_output():
net = RBFnet()
input = np.array([0,1,2])
output = input+1j*input
net.train(input, output, num=2)
assert np.allclose(output, net.predict(input))
assert np.allclose(output, net.predict(input), atol=1e-5)

0 comments on commit 4151a4b

Please sign in to comment.