Created
May 30, 2018 12:52
-
-
Save hossein761/3bc3b488761f0f7718b1aca1f7c63ae9 to your computer and use it in GitHub Desktop.
Gaussian mixture models using Coinograph's candle data
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
# train the models | |
gmm = GMM(n_components=5).fit(candles_df[['low', 'high', 'volume']]) | |
# get the lables | |
labels = gmm.predict(candles_df[['low', 'high', 'volume']]) | |
# visualise the mixture components (clusters) | |
volume = candles_df['volume'].values | |
high = candles_df['high'].values | |
low = candles_df['low'].values | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
ax.scatter(low, high, volume, c=labels, s=4, cmap='viridis') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment