File size: 951 Bytes
dd937b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import numpy as np
from sklearn.linear_model import LogisticRegression
import joblib

# Generate synthetic data
np.random.seed(42)
n_samples = 200
X = np.column_stack([
    np.random.uniform(0, 24, n_samples),  # usage_hours
    np.random.uniform(0, 24, n_samples),  # idle_hours
    np.random.uniform(0, 10, n_samples),  # movement_frequency
    np.random.uniform(10, 100, n_samples) # cost_per_hour
])

y = []
for usage, idle, movement, cost in X:
    if usage < 5 and idle > 15:
        y.append(1)  # Pause Rent
    elif idle > 10 and movement < 2:
        y.append(0)  # Move
    elif cost > 80:
        y.append(3)  # Replace
    else:
        y.append(2)  # Repair
y = np.array(y)

# Train logistic regression model
model = LogisticRegression(multi_class='ovr', max_iter=200)
model.fit(X, y)

# Save model to disk
joblib.dump(model, "equipment_utilization_model.joblib")
print("Model trained and saved as 'equipment_utilization_model.joblib'")