Instructions to use SAP/sap-rpt-1-oss with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sap-rpt-1-oss
How to use SAP/sap-rpt-1-oss with sap-rpt-1-oss:
pip install git+https://github.com/SAP-samples/sap-rpt-1-oss
# Run a classification task from sklearn.datasets import load_breast_cancer from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split from sap_rpt_oss import SAP_RPT_OSS_Classifier # Load sample data X, y = load_breast_cancer(return_X_y=True) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42) # Initialize a classifier, 8k context and 8-fold bagging gives best performance, reduce if running out of memory clf = SAP_RPT_OSS_Classifier(max_context_size=8192, bagging=8) clf.fit(X_train, y_train) # Predict probabilities prediction_probabilities = clf.predict_proba(X_test) # Predict labels predictions = clf.predict(X_test) print("Accuracy", accuracy_score(y_test, predictions))# Run a regression task from sklearn.datasets import fetch_openml from sklearn.metrics import r2_score from sklearn.model_selection import train_test_split from sap_rpt_oss import SAP_RPT_OSS_Regressor # Load sample data df = fetch_openml(data_id=531, as_frame=True) X = df.data y = df.target.astype(float) # Train-test split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42) # Initialize the regressor, 8k context and 8-fold bagging gives best performance, reduce if running out of memory regressor = SAP_RPT_OSS_Regressor(max_context_size=8192, bagging=8) regressor.fit(X_train, y_train) # Predict on the test set predictions = regressor.predict(X_test) r2 = r2_score(y_test, predictions) print("RΒ² Score:", r2) - Notebooks
- Google Colab
- Kaggle
Update pipeline tag
#4
by nielsr HF Staff - opened
Looks like "tabular classification" is appropriate here.
It was previously changed to Other as the model supports both regression and classification
Ok, will close this one.
nielsr changed pull request status to closed