zipml
1.0.0
Zipml 은 소형 데이터 세트 용으로 설계된 경량 자동 라이브러리로 열차 테스트 분할, 모델 비교 및 혼동 매트릭스 생성과 같은 필수 도우미 기능을 제공합니다.
zipml/
│
├── data/
│ ├── encoding.py
│ ├── file_operations.py
│ ├── split_data.py
│
├── model/
│ ├── analyze_model_predictions.py
│ ├── calculate_model_results.py
│ ├── measure_prediction_time.py
│
├── utils/
│ ├── calculate_sentence_length_percentile.py
│ ├── read_time_series_data.py
│
├── visualization/
│ ├── combine_and_plot_model_results.py
│ ├── plot_random_image.py
│ ├── plot_time_series.py
│ ├── save_and_plot_confusion_matrix.py
│
└── zipml.pyzipml 패키지 사용 방법 zipml 패키지는 AI 및 기계 학습 워크 플로를 단순화하도록 설계된 데이터 전처리 데이터, 모델 분석 및 결과 시각화를위한 다양한 유틸리티를 제공합니다. 다음은 주요 기능 중 일부를 사용하는 지침입니다.
analyze_model_predictions.py : 모델 예측을 실제 값과 비교하여 모델 예측을 평가하고 가장 잘못된 예측과 함께 자세한 예측 데이터를 반환합니다. from zipml . model import analyze_model_predictions
val_df , most_wrong = analyze_model_predictions ( best_model , X_test , y_test )PIP를 통해 패키지 설치 :
pip install zipml또는 저장소를 복제하십시오.
git clone https://github.com/abdozmantar/zipml.git
cd zipml
pip install . 다음은 zipml을 사용하는 방법에 대한 실질적인 예입니다.
import pandas as pd
from zipml . model import analyze_model_predictions
from zipml . model import calculate_model_results
from zipml . visualization import save_and_plot_confusion_matrix
from zipml . data import split_data
from zipml import compare_models
from sklearn . ensemble import RandomForestClassifier , GradientBoostingClassifier
from sklearn . linear_model import LogisticRegression
# Sample dataset
data = {
'feature_1' : [ 0.517 , 0.648 , 0.105 , 0.331 , 0.781 , 0.026 , 0.048 ],
'feature_2' : [ 0.202 , 0.425 , 0.643 , 0.721 , 0.646 , 0.827 , 0.303 ],
'feature_3' : [ 0.897 , 0.579 , 0.014 , 0.167 , 0.015 , 0.358 , 0.744 ],
'feature_4' : [ 0.457 , 0.856 , 0.376 , 0.527 , 0.648 , 0.534 , 0.047 ],
'feature_5' : [ 0.046 , 0.118 , 0.222 , 0.001 , 0.969 , 0.239 , 0.203 ],
'target' : [ 0 , 1 , 1 , 1 , 1 , 1 , 0 ]
}
# Creating DataFrame
df = pd . DataFrame ( data )
# Splitting data into features (X) and target (y)
X = df . drop ( 'target' , axis = 1 )
y = df [ 'target' ]
# Split the data into training and test sets
X_train , X_test , y_train , y_test = split_data ( X , y )
# Define models
models = [
RandomForestClassifier (),
LogisticRegression (),
GradientBoostingClassifier ()
]
# Compare models and select the best one
best_model , performance = compare_models ( models , X_train , X_test , y_train , y_test )
print ( f"Best model: { best_model } with performance: { performance } " )
# Calculate performance metrics for the best model
best_model_metrics = calculate_model_results ( y_test , best_model . predict ( X_test ))
# Analyze model predictions
val_df , most_wrong = analyze_model_predictions ( best_model , X_test , y_test )
# Save and plot confusion matrix
save_and_plot_confusion_matrix ( y_test , best_model . predict ( X_test ), save_path = "confusion_matrix.png" )다음 명령을 사용하여 명령 줄에서 ZipML을 실행할 수 있습니다.
zipml --train train.csv --test test.csv --model randomforest --result results.json--train : 교육 데이터 세트 CSV 파일로가는 경로.--test : 테스트 데이터 세트 CSV 파일로가는 경로.--model : 교육 할 모델의 이름 (예 : randomforest , logisticregression , gradientboosting ).--result : 결과가 저장 될 JSON 파일로가는 경로. zipml --train train.csv --test test.csv --compare --compare_models randomforest svc knn --result results.json--compare : 다중 모델 비교를 나타내는 플래그.--compare_models : 비교할 모델 목록 (예 : randomforest , logisticregression , gradientboosting ).--result : 비교 결과가 저장되는 JSON 파일로가는 경로. zipml --load_model trained_model.pkl --test test.csv --result predictions.json--load_model : 저장된 모델 파일로가는 경로.--test : 테스트 데이터 세트 CSV 파일로가는 경로.--result : 예측이 저장 될 JSON 파일로가는 경로. 훈련 후 훈련 된 모델을 저장하려면 :
zipml --train train.csv --test test.csv --model randomforest --save_model trained_model.pkl--result : 훈련 된 모델이 저장 될 파일로의 경로.git checkout -b feature/foo ).git commit -am 'Add some foo' ).git push origin feature/foo )로 푸시하십시오.Abdullah Ozmantar Github : @abdozmantar
이 프로젝트는 MIT 라이센스에 따라 라이센스가 부여됩니다. 자세한 내용은 라이센스 파일을 참조하십시오.