Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to load model.h5 #24

Closed
ryan-gz opened this issue Jan 17, 2022 · 2 comments
Closed

how to load model.h5 #24

ryan-gz opened this issue Jan 17, 2022 · 2 comments

Comments

@ryan-gz
Copy link

ryan-gz commented Jan 17, 2022

Hi Florent, I've got some doc vectors,and tried to fit the model.
Now I got some trained models( named like 'model_40.h5'). I want to see the details of clustering or predict new doc vectors, how could I load these DTC models?
Many thanks.

@lushunn
Copy link

lushunn commented Jan 17, 2022

This is my code

from DeepTemporalClustering import  DTC
from  datasets_ts import  load_data
import numpy as np
dtc = DTC(n_clusters=5,
          input_dim=8,
          timesteps=168,
          n_filters=50,
          kernel_size=10,
          strides=1,
          pool_size=24,
          n_units=[50, 10],
          alpha=1.0,
          dist_metric='eucl',
          cluster_init='kmeans',
          heatmap=True) # same as your training parameters
dtc.initialize()
dtc.load_weights('results/tmp/DTC_model_final.h5')
import joblib
X = joblib.load('./data/X.h5') ## your test data
pred=dtc.predict(X)

@ryan-gz ryan-gz closed this as completed Jan 20, 2022
@ryan-gz
Copy link
Author

ryan-gz commented Jan 20, 2022

@lushunn Thanks! It really helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants