Mai Chí Bảo commited on
Commit
e319c16
·
1 Parent(s): 7bd2429

sample classification add

Browse files
Files changed (4) hide show
  1. Makefile +6 -1
  2. README.md +1 -1
  3. requirements.txt +2 -1
  4. sample_classification.py +25 -0
Makefile CHANGED
@@ -1,5 +1,10 @@
1
  install:
2
  pip install -r requirements.txt
3
 
4
- runhello:
5
  python hello.py
 
 
 
 
 
 
1
  install:
2
  pip install -r requirements.txt
3
 
4
+ run1:
5
  python hello.py
6
+ run2:
7
+ python sample_classification.py
8
+ run3:
9
+ python hello.py
10
+ python sample_classification.py
README.md CHANGED
@@ -1,2 +1,2 @@
1
  # HuFaMLops
2
- Using Higging Face model to learn MLops
 
1
  # HuFaMLops
2
+ Using Hugging Face model to learn MLops
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  pandas
2
- numpy
 
 
1
  pandas
2
+ numpy
3
+ scikit-learn
sample_classification.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)