save a load from model
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,4 +4,5 @@ env/
|
||||
*.xlsx
|
||||
*.csv
|
||||
*.json
|
||||
cloud-functions/python/functions/__pycache__/
|
||||
cloud-functions/python/functions/__pycache__/
|
||||
*.pkl
|
||||
|
||||
@@ -3,6 +3,7 @@ from sklearn.model_selection import train_test_split
|
||||
from sklearn.linear_model import LogisticRegression
|
||||
from sklearn.preprocessing import LabelEncoder
|
||||
from sklearn.metrics import accuracy_score, classification_report
|
||||
import pickle
|
||||
|
||||
data = pd.read_excel('/Users/apple/Downloads/21092023-July_Sept.xlsx', sheet_name="op")
|
||||
data = data.dropna()
|
||||
@@ -29,3 +30,14 @@ classification_report_result = classification_report(y_test, y_pred)
|
||||
print(f"Accuracy: {accuracy}")
|
||||
print("Classification Report:")
|
||||
print(classification_report_result)
|
||||
|
||||
# with open('logistic_regression_model.pkl', 'wb') as model_file:
|
||||
# pickle.dump(model, model_file)
|
||||
|
||||
|
||||
# with open('logistic_regression_model.pkl', 'rb') as model_file:
|
||||
# loaded_model = pickle.load(model_file)
|
||||
|
||||
# new_data = pd.DataFrame({'Age': [30], 'Gender': ['MALE'], 'Caste': ['SC'], 'Category': [''], 'Marital Status': ['Single']})
|
||||
# predicted_result = loaded_model.predict(new_data)
|
||||
# print(predicted_result)
|
||||
Reference in New Issue
Block a user