DmytroSerbeniuk commited on
Commit
ba82c13
·
verified ·
1 Parent(s): 001eb4e

Initial commit: iris model

Browse files
Files changed (5) hide show
  1. README.md +35 -0
  2. config.json +6 -0
  3. inference.py +29 -0
  4. model.joblib +3 -0
  5. requirements.txt +3 -0
README.md CHANGED
@@ -1,3 +1,38 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
+ # Iris Classifier Logistic Regression
6
+
7
+ This is a simple logistic regression model trained on the classic Iris dataset using scikit-learn.
8
+
9
+ ## Model Details
10
+
11
+ - **Model type:** Logistic Regression
12
+ - **Library:** scikit-learn
13
+ - **Features:** `sepal_length`, `sepal_width`, `petal_length`, `petal_width`
14
+ - **Classes:** setosa, versicolor, virginica
15
+
16
+ ## Usage
17
+
18
+ ```python
19
+ import joblib
20
+ import pandas as pd
21
+
22
+ model = joblib.load("model.joblib")
23
+ sample = pd.DataFrame([[5.1, 3.5, 1.4, 0.2]], columns=["sepal_length", "sepal_width", "petal_length", "petal_width"])
24
+ pred = model.predict(sample)
25
+ print(pred)
26
+ ```
27
+
28
+ requirements.txt
29
+ ```txt
30
+ scikit-learn
31
+ pandas
32
+ joblib
33
+ ```
34
+
35
+ Признаки Вид
36
+ 5.1 3.5 1.4 0.2 setosa
37
+ 6.0 2.2 4.0 1.0 versicolor
38
+ 6.9 3.1 5.4 2.1 virginica
config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "logistic_regression",
3
+ "features": ["sepal_length", "sepal_width", "petal_length", "petal_width"],
4
+ "classes": ["setosa", "versicolor", "virginica"],
5
+ "library": "scikit-learn"
6
+ }
inference.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import joblib
3
+ import pandas as pd
4
+
5
+ # Загрузка модели
6
+ model = joblib.load("model.joblib")
7
+
8
+ # Проверка аргументов
9
+ if len(sys.argv) != 5:
10
+ print("❌ Usage: python3 inference.py <sepal_length> <sepal_width> <petal_length> <petal_width>")
11
+ sys.exit(1)
12
+
13
+ # Преобразование входных значений
14
+ sepal_length = float(sys.argv[1])
15
+ sepal_width = float(sys.argv[2])
16
+ petal_length = float(sys.argv[3])
17
+ petal_width = float(sys.argv[4])
18
+
19
+ # Формирование DataFrame с названиями признаков
20
+ input_data = pd.DataFrame([{
21
+ "sepal_length": sepal_length,
22
+ "sepal_width": sepal_width,
23
+ "petal_length": petal_length,
24
+ "petal_width": petal_width
25
+ }])
26
+
27
+ # Предсказание
28
+ prediction = model.predict(input_data)
29
+ print(f"🌸 Predicted class: {prediction[0]}")
model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8d68c2b8268b0f114a2b87c940516e8413f36087e0aba78d6f6e15ff35d624de
3
+ size 1407
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ scikit-learn
2
+ pandas
3
+ joblib