File size: 1,623 Bytes
77aba43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47

# Logistic Regression Model for Binary Classification

This repository hosts a simple Logistic Regression model trained on a synthetic dataset for binary classification. The model is built using `scikit-learn` and saved using `joblib`.

## Model Description

- **Model Type**: Logistic Regression (for binary classification)
- **Framework**: Scikit-learn
- **Training Data**: Synthetic dataset generated using `sklearn.datasets.make_classification`.
- **Purpose**: Demonstrates the process of saving and uploading a basic Scikit-learn model to the Hugging Face Hub.

## How to Use

To load and use this model, you can follow these steps in your Python environment:

```python
from huggingface_hub import hf_hub_download
import joblib
import numpy as np

# Define the repository ID and the model file path
repo_id = "farooqhasanDA/logistic_regression_model-sklearn-model" # Replace with your actual repo_id
filename = "models/logistic_regression_model.joblib"

# Download the model file
model_path = hf_hub_download(repo_id=repo_id, filename=filename)

# Load the model
loaded_model = joblib.load(model_path)

# Example usage: Make a prediction
# Create a dummy input similar to the training data (e.g., 4 features)
dummy_input = np.array([[0.5, -0.2, 1.1, -0.7]])

prediction = loaded_model.predict(dummy_input)
prediction_proba = loaded_model.predict_proba(dummy_input)

print(f"Prediction: {prediction[0]}")
print(f"Prediction Probabilities: {prediction_proba[0]}")
```

## License

This project is licensed under the Apache License 2.0. See the [LICENSE](https://www.apache.org/licenses/LICENSE-2.0) file for details.