Skip to content

Instantly share code, notes, and snippets.

@AI-MOO
Last active March 17, 2022 22:36
Show Gist options
  • Save AI-MOO/fb919aa24c769617b2a761be6704fbf1 to your computer and use it in GitHub Desktop.
Save AI-MOO/fb919aa24c769617b2a761be6704fbf1 to your computer and use it in GitHub Desktop.
# المتغيرات الخاصة بالفئات الموجودة في الأعمدة
Acc = 0
Gyro = 0
other = 0
for value in training_data.columns:
# التحقق من الأعمدة التي تحتوي على مستشعر التسارع
if "Acc" in str(value):
Acc += 1
# التحقق من الأعمدة التي تحتوي على مستشعر الدوران
elif "Gyro" in str(value):
Gyro += 1
# الأعمدة التي لا تشمل الفئتين السابقتين
else:
other += 1
# طباعة عدد الأعمدة التابعة لكل فئة وتصويرها بيانيًا
plt.figure(figsize = (10, 5))
print(f"Accelerometer:{Acc}\nGyroscope:{Gyro}\nOthers:{other}")
plt.bar(['Accelerometer', 'Gyroscope', 'Others'], [Acc, Gyro, other], color=('#002594','#00944c','#b31204'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment