Created
April 22, 2019 00:23
-
-
Save Skanda319/71b04f60b4d1fbcb8e323e65e045657b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X_train = train[["date", "return", "range", "close"]].set_index("date") | |
X_test = test[["date", "return", "range", "close"]].set_index("date") | |
model = mix.GaussianMixture(n_components=3, | |
covariance_type="full", | |
n_init=100, | |
random_state=7).fit(X_train) | |
# Predict the optimal sequence of internal hidden state | |
hidden_states = model.predict(X_test) | |
print("Means and vars of each hidden state") | |
for i in range(model.n_components): | |
print("{0}th hidden state".format(i)) | |
print("mean = ", model.means_[i]) | |
print("var = ", np.diag(model.covariances_[i])) | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment