Skip to content

Commit

Permalink
fix tica transform bug
Browse files Browse the repository at this point in the history
  • Loading branch information
williamgilpin committed Mar 29, 2021
1 parent 80c349e commit 9248711
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 103 deletions.
160 changes: 71 additions & 89 deletions demos.ipynb

Large diffs are not rendered by default.

13 changes: 2 additions & 11 deletions exploratory.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"outputs": [],
"source": [
"import numpy as np\n",
"import warnings\n",
Expand Down
2 changes: 1 addition & 1 deletion fnn/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def fit(self, X, y=None, subsample=None):
self.model.fit(np.reshape(X_train, (X_train.shape[0], -1)))

def transform(self, X, y=None):
X_test = hankel_matrix(standardize_ts(X), len(X) - self.time_window, q = self.time_window)
X_test = hankel_matrix(standardize_ts(X), self.time_window)
X_test = np.reshape(X_test, (X_test.shape[0], -1))
if self.time_lag > 0:
X_new = self.model.transform([X_test])[0]
Expand Down
3 changes: 1 addition & 2 deletions fnn/regularizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ def loss_false(code_batch, k=1):

# Eq. 4 of Kennel et al.
scaled_dist = tf.sqrt(
(tf.square(neighbor_new_dists) - tf.square(neighbor_dists_d[:-1]))
/ tf.square(neighbor_dists_d[:-1])
(neighbor_new_dists - neighbor_dists_d[:-1]) / neighbor_dists_d[:-1]
)

# Kennel condition #1
Expand Down

0 comments on commit 9248711

Please sign in to comment.