Coder Social home page Coder Social logo

Comments (3)

roman-kh avatar roman-kh commented on August 28, 2024

batch_size specifies how many items should be processed in one iteration.

When you run the pipeline, it takes batch_size items from your dataset index and execute each action in the pipeline:

  • load to load data fo each item in the batch
  • cwt to make wavelet transform
    and so on.

See batchflow documentation and tutorials for details.

from cardio.

koicu avatar koicu commented on August 28, 2024

nice :) i solve it
and.. i have one more problem
when i run this code, this error come out

i use 'q1c' parameter not 'pu1' when i init HMM initialize parameter

thanx to your reply have a good day!

.load(fmt='wfdb', components=["signal", "annotation", "meta"], ann_ext='q1c')

Traceback (most recent call last):

File "", line 142, in
expanded = np.concatenate([expand_annotation(samp, types, length) for samp, types, length in zip(annsamp, anntype, lengths)])

File "", line 142, in
expanded = np.concatenate([expand_annotation(samp, types, length) for samp, types, length in zip(annsamp, anntype, lengths)])

File "", line 49, in expand_annotation
annot_expand[begin:end] = states[s]

KeyError: 'u'

template_ppl_inits = (
bf.Pipeline()
.init_variable("annsamps", init_on_each_run=list)
.init_variable("anntypes", init_on_each_run=list)
.init_variable("hmm_features", init_on_each_run=list)
.load(fmt='wfdb', components=["signal", "annotation", "meta"], ann_ext='q1c')
.cwt(src="signal", dst="hmm_features", scales=[4,8,16], wavelet="mexh")
.standardize(axis=-1, src="hmm_features", dst="hmm_features")
.update_variable("annsamps", bf.F(get_annsamples), mode='e')
.update_variable("anntypes", bf.F(get_anntypes), mode='e')
.update_variable("hmm_features", bf.B("hmm_features"), mode='e')
.run(batch_size=20, shuffle=False, drop_last=False, n_epochs=1, lazy=True)

)
#%%
index.drop_channels()
#%%
from cardio.pipelines import hmm_preprocessing_pipeline, hmm_train_pipeline
import warnings
warnings.filterwarnings('ignore')

pipeline = hmm_preprocessing_pipeline()
ppl_inits = (dtst >> pipeline).run()

ppl_inits = (dtst >> template_ppl_inits).run()

#lengths = [hmm_features.shape[2] for hmm_features in ppl_inits.get_variable("hmm_features")]
lengths = [hmm_features.shape[2] for hmm_features in ppl_inits.get_variable("hmm_features")]
hmm_features = np.concatenate([hmm_features[0,:,:].T for hmm_features in ppl_inits.get_variable("hmm_features")])
anntype = ppl_inits.get_variable("anntypes")
annsamp = ppl_inits.get_variable("annsamps")

expanded = np.concatenate([expand_annotation(samp, types, length) for samp, types, length in zip(annsamp, anntype, lengths)])

means, covariances = prepare_means_covars(hmm_features, expanded, states = [3, 5, 11, 14, 17, 19], num_features = 3)

transition_matrix, start_probabilities = prepare_transmat_startprob()

from cardio.

Shlyankin avatar Shlyankin commented on August 28, 2024

KeyError: 'u'
I think, that is 'u' wave in annotations file. Standard function don't process 'u' wave. If you want to recognize 'u' waves you should rework code for this. Good luck.

from cardio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.