Skip to content

Instantly share code, notes, and snippets.

@hossein761
Created May 30, 2018 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hossein761/3bc3b488761f0f7718b1aca1f7c63ae9 to your computer and use it in GitHub Desktop.
Save hossein761/3bc3b488761f0f7718b1aca1f7c63ae9 to your computer and use it in GitHub Desktop.
Gaussian mixture models using Coinograph's candle data
# 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