#๐Ÿ”’ ML-Project

7 messages ยท Page 1 of 1 (latest)

wraith flameBOT
#

@drowsy basin

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

drowsy basin
#

Hi

#

i try to conv string to float but it's not working and i dont know what to solve it

#
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler


from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import VotingClassifier
from sklearn.metrics import classification_report
data = pd.read_csv("Epileptic Seizure Recognition.csv")
data.head()
X = data.drop(columns=['y'])
y = data['y'].copy()
y[y > 1] = 0
non_seizure, seizure = y.value_counts()

print('number of trials for the non-seizure class :', non_seizure) # class 0
print('number of trials for the seizure class :', seizure) # class 1,2,3,4,5
# Extracting the numeric part of the strings
numeric_values = np.array([float(s.split('V')[1]) for s in data['Unnamed']]).reshape(-1, 1)

# Scaling numeric values
scaler = StandardScaler()
scaled_numeric_values = scaler.fit_transform(numeric_values)

data['Unnamed'] = scaled_numeric_values
data['Unnamed'] = data['Unnamed'].astype(float)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, shuffle = True , random_state=42)

svm_clf = SVC(kernel='linear', C=0.025)
mlp_clf = MLPClassifier(hidden_layer_sizes=(100,), max_iter=1000)
ensemble_clf = VotingClassifier(estimators=[('svm', svm_clf), ('mlp', mlp_clf)], voting='hard')
column_types = data.dtypes
column_types
# Training the ensemble classifier
ensemble_clf.fit(X_train, y_train)
paper jasper
#

numeric_values = np.array([float(s.split('V')[1]) for s in data['Unnamed']]).reshape(-1, 1) This part?

wraith flameBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.