r13i / ecg-classify Goto Github PK
View Code? Open in Web Editor NEWClassifying Heartbeat Arrhythmia using novel features (Auto-regressive coefficients & RR inter-beat distance)
License: MIT License
Classifying Heartbeat Arrhythmia using novel features (Auto-regressive coefficients & RR inter-beat distance)
License: MIT License
Hello, thanks for your code it's mean a lot to help my project.
I tried to implement your code with polysomnography data. it's work until I try to implement Model Fitting, I try to solve the problem, but when I check the Feature Extraction step, I found the code cant process the data, the plot in 'if not' didn't show, here the code I mean
lst = list()
for i in DS1:
rec_index = i
# Tweak the use_filter param
lst = extract_features("slpdb/" + rec_index, length_qrs, length_stt, ar_order_qrs=3, ar_order_stt=3, use_filter=True)
df = pd.DataFrame(lst)
#I try to print the code but the output is null [ ]
if not df.empty and not df[df["type"] == "VEB"].empty and not df[df["type"] == "N"].empty:
n_pre_rr = df[df["type"] == "N"]["pre-RR"]
veb_pre_rr = df[df["type"] == "VEB"]["pre-RR"]
n_post_rr = df[df["type"] == "N"]["post-RR"]
veb_post_rr = df[df["type"] == "VEB"]["post-RR"]
fig1 = plt.figure()
ax1 = fig1.add_subplot(121, title="Record {} | Pre-RR")
ax1.scatter(n_pre_rr, c="c", label="Normal")
ax1.scatter(veb_pre_rr, c="r", label="VEB")
n_qrs_ar_array = series2arCoeffs(df[df["type"] == "N"]["QRS_ar_coeffs"])
veb_qrs_ar_array = series2arCoeffs(df[df["type"] == "VEB"]["QRS_ar_coeffs"])
n_stt_ar_array = series2arCoeffs(df[df["type"] == "N"]["ST/T_ar_coeffs"])
veb_stt_ar_array = series2arCoeffs(df[df["type"] == "VEB"]["ST/T_ar_coeffs"])
fig = plt.figure(figsize=(20, 5))
ax1 = fig.add_subplot(141, title="Record {} | QRS | a0 vs a1".format(rec_index))
plt.ylim(-2.5, 0.5)
plt.xlim(0.8, 2.6)
ax1.scatter(x=n_qrs_ar_array[:, 0], y=n_qrs_ar_array[:, 1], c='c', label="Normal")
ax1.scatter(x=veb_qrs_ar_array[:, 0], y=veb_qrs_ar_array[:, 1], c='r', label="VEB")
plt.legend(loc="best")
ax2 = fig.add_subplot(142, title="Record {} | QRS | a1 vs a2".format(rec_index))
plt.ylim(-0.6, 0.8)
plt.xlim(-2.5, 0.5)
ax2.scatter(x=n_qrs_ar_array[:, 1], y=n_qrs_ar_array[:, 2], c='c', label="Normal")
ax2.scatter(x=veb_qrs_ar_array[:, 1], y=veb_qrs_ar_array[:, 2], c='r', label="VEB")
plt.legend(loc="best")
ax3 = fig.add_subplot(143, title="Record {} | ST/T | a0 vs a1".format(rec_index))
plt.ylim(-3, 0.5)
plt.xlim(0.5, 3)
ax3.scatter(x=n_stt_ar_array[:, 0], y=n_stt_ar_array[:, 1], c='c', label="Normal")
ax3.scatter(x=veb_stt_ar_array[:, 0], y=veb_stt_ar_array[:, 1], c='r', label="VEB")
plt.legend(loc="best")
ax4 = fig.add_subplot(144, title="Record {} | ST/T | a1 vs a2".format(rec_index))
plt.ylim(-0.6, 1)
plt.xlim(-3, 0.5)
ax4.scatter(x=n_stt_ar_array[:, 1], y=n_stt_ar_array[:, 2], c='c', label="Normal")
ax4.scatter(x=veb_stt_ar_array[:, 1], y=veb_stt_ar_array[:, 2], c='r', label="VEB")
plt.legend(loc="best")
else:
print("Record {} : At least one empty category : VEB or N.".format(rec_index)
What should I do to solve the code?
Thanks for your help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.