Spaces:
Runtime error
Runtime error
Mai Chí Bảo
commited on
Delete sample_classification.py
Browse files- sample_classification.py +0 -25
sample_classification.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
import numpy as np
|
2 |
-
from sklearn.linear_model import LogisticRegression
|
3 |
-
|
4 |
-
# Generate random data
|
5 |
-
X = np.random.randint(0, 100, (1000, 2))
|
6 |
-
y = np.random.randint(0, 2, 1000)
|
7 |
-
|
8 |
-
# Split the data into training and test sets
|
9 |
-
X_train = X[:750]
|
10 |
-
y_train = y[:750]
|
11 |
-
X_test = X[750:]
|
12 |
-
y_test = y[750:]
|
13 |
-
|
14 |
-
# Create the classifier
|
15 |
-
clf = LogisticRegression()
|
16 |
-
|
17 |
-
# Train the classifier
|
18 |
-
clf.fit(X_train, y_train)
|
19 |
-
|
20 |
-
# Predict the labels of the test set
|
21 |
-
y_pred = clf.predict(X_test)
|
22 |
-
|
23 |
-
# Evaluate the accuracy of the classifier
|
24 |
-
accuracy = np.mean(y_pred == y_test)
|
25 |
-
print("Accuracy:", accuracy)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|