Saravanan666/pypi-org huggingface dataset:
Package: sklearn2vantage
sklearn2vantage is a Python module for converting sklearn model to Teradata
Vantage model table.This module has 2 feature. One is converting scikit-learn model to Teradata
Vantage model and another is uploading pandas dataframe to Teradata.InstallationDependenciessklearn2vantage requires:PythonNumPypandasSQLAlchemyscikit-learnparamikoscpteradatasqlalchemy-teradatateradatasqlteradatasqlalchemySupported modelFollowing models are supported.scikit-learnTeradata VantageRandomForestClassifierDecisionForestPredictRandomForestRegressorDecisionForestPredictGradientBoostRegressorDecisionForestPredictLinearRegressionGLMPredictLassoGLMPredictRidgeGLMPredictLinearGLMPredictLogisticRegressionGLMPredictGaussianNBNaiveBayesPredictCategoricalNBNaiveBayesPredictDecisionTreeClassifierDecisionTreePredictDecusionTreeRegressorDecisionTreePredictSome models in statsmodels are also supported.statsmodelsTeradata VantageLogitGLMPredictOLSGLMPredictUser installationpip install sklearn2vantageorconda install sklearn2vantage -c temporary-recipesExample: conveting modelimport sklearn2vantage as s2v
import pandas as pd
from sqlalchemy import create_engine
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier

engine = create_engine("teradata://dbc:dbc@173.168.56.128:1025/tdwork")

df = pd.read_sql_query("select * from some_data sample 50000", engine)
X = df.drop("target", axis=1)
y = df.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25)

rf_clf = RandomForestClassifier()
rf_clf.fit(X_train, y_train)

rf_clf_table = \
  s2v.make_model_table_forest(rf_clf, X_train.columns,
                              ['setosa', 'versicolor', 'virginica'])

s2v.load_model_forest(rf_clf_table, engine, "rf_clf_table")
pd.read_sql_query("""
  select * from DecisionForestPredict (
    on iris partition by any
    on rf_clf_table as ModelTable DIMENSION
    USING
    NumerixInputs ('sepal_length', 'sepal_width',
                  'petal_length', 'petal_width')
    IdColumn ('id')
    Accumulate ('species')
    Detailed ('false')
) as dt""", engine)For further usage, please seeHowToUse.ipynb.Example: data loadingimport pandas as pd
import sklearn2vantage as s2v
from sqlalchemy import create_engine
engine = create_engine("teradata://dbc:dbc@173.168.56.128:1025/tdwork")
df_titanic = pd.read_csv("titanic/train.csv").set_index("PassengerId")
s2v.tdload_df(df_titanic, engine, tablename="titanic_train",
              ifExists="replace", ssh_ip="173.168.56.128",
              ssh_username="root", ssh_password="root")For further usage, please seeHowToUseDataloader.ipynb.
Package: sklearn-compiledtrees
InstallationReleased under the MIT License.pipinstallsklearn-compiledtreesRationaleIn some use cases, predicting given a model is in the hot-path, so
speeding up decision tree evaluation is very useful.An effective way of speeding up evaluation of decision trees can be to
generate code representing the evaluation of the tree, compile that to
optimized object code, and dynamically load that file via dlopen/dlsym
or equivalent.Seehttps://courses.cs.washington.edu/courses/cse501/10au/compile-machlearn.pdffor a detailed discussion, andhttp://tullo.ch/articles/decision-tree-evaluation/for a more
pedagogical explanation and more benchmarks in C++.This package implements compiled decision tree evaluation for the simple
case of a single-output regression tree or ensemble.It has been tested to work on both OS X and Linux. We do not currently
support Windows platforms for compiled evaluation, although this should
not be a signficant amount of work.Usageimportcompiledtreesimportsklearn.ensembleX_train,y_train,X_test,y_test=...clf=ensemble.GradientBoostingRegressor()clf.fit(X_train,y_train)compiled_predictor=compiledtrees.CompiledRegressionPredictor(clf)predictions=compiled_predictor.predict(X_test)BenchmarksFor random forests, we see 5x to 8x speedup in evaluation. For gradient
boosted ensembles, it’s between a 1.5x and 3x speedup in evaluation.
This is due to the fact that gradient boosted trees already have an
optimized prediction implementation.There is a benchmark script attached that allows us to examine the
performance of evaluation across a range of ensemble configurations and
datasets.In the graphs attached,GBis Gradient Boosted,RFis Random
Forest,D1, etc correspond to settingmax-depth=1, andB10corresponds to settingmax_leaf_nodes=10.Graphsfordatasetinfriedman1friedman2friedman3uniformhastie;dopython../benchmarks/bench_compiled_tree.py\--iterations=10\--num_examples=1000\--num_features=50\--dataset=$dataset\--max_estimators=300\--num_estimator_values=6done
Package: sklearn-contrib-lightning
lightninglightning is a library for large-scale linear classification, regression and
ranking in Python.Highlights:follows thescikit-learnAPI conventionssupports natively both dense and sparse data representationscomputationally demanding parts implemented inCythonSolvers supported:primal coordinate descentdual coordinate descent (SDCA, Prox-SDCA)SGD, AdaGrad, SAG, SAGA, SVRGFISTAExampleExample that shows how to learn a multiclass classifier with group lasso
penalty on the News20 dataset (c.f.,Blondel et al. 2013):fromsklearn.datasetsimportfetch_20newsgroups_vectorizedfromlightning.classificationimportCDClassifier# Load News20 dataset from scikit-learn.bunch=fetch_20newsgroups_vectorized(subset="all")X=bunch.datay=bunch.target# Set classifier options.clf=CDClassifier(penalty="l1/l2",loss="squared_hinge",multiclass=True,max_iter=20,alpha=1e-4,C=1.0/X.shape[0],tol=1e-3)# Train the model.clf.fit(X,y)# Accuracyprint(clf.score(X,y))# Percentage of selected featuresprint(clf.n_nonzero(percentage=True))Dependencieslightning requires Python >= 3.7, setuptools, Joblib, Numpy >= 1.12, SciPy >= 0.19 and
scikit-learn >= 0.19. Building from source also requires Cython and a working C/C++ compiler. To run the tests you will also need pytest.InstallationPrecompiled binaries for the stable version of lightning are available for the main platforms and can be installed using pip:pipinstallsklearn-contrib-lightningor conda:condainstall-cconda-forgesklearn-contrib-lightningThe development version of lightning can be installed from its git repository. In this case it is assumed that you have the git version control system, a working C++ compiler, Cython and the numpy development libraries. In order to install the development version, type:gitclonehttps://github.com/scikit-learn-contrib/lightning.gitcdlightningpythonsetup.pyinstallDocumentationhttp://contrib.scikit-learn.org/lightning/On GitHubhttps://github.com/scikit-learn-contrib/lightningCitingIf you use this software, please cite it. Here is a BibTex snippet that you can use:@misc{lightning_2016,
  author       = {Blondel, Mathieu and
                  Pedregosa, Fabian},
  title        = {{Lightning: large-scale linear classification,
                 regression and ranking in Python}},
  year         = 2016,
  doi          = {10.5281/zenodo.200504},
  url          = {https://doi.org/10.5281/zenodo.200504}
}Other citing formats are available inits Zenodo entry.AuthorsMathieu BlondelManoj KumarArnaud RachezFabian PedregosaNikita Titov
Package: sklearn-crfsuite
sklearn-crfsuite is a thinCRFsuite(python-crfsuite) wrapper which provides
interface simlar toscikit-learn.sklearn_crfsuite.CRFis a scikit-learn
compatible estimator: you can use e.g. scikit-learn model
selection utilities (cross-validation, hyperparameter optimization) with it,
or save/load CRF models usingjoblib.License is MIT.Documentation can be foundhere.Changes0.3.6 (2017-06-22)addedsklearn_crfsuite.metrics.flat_recall_score.0.3.5 (2017-03-21)Properly close file descriptor inFileResource.cleanup;declare Python 3.6 support, stop testing on Python 3.3.0.3.4 (2016-11-17)Small formatting fixes.0.3.3 (2016-03-15)scikit-learn dependency is now optional for sklearn_crfsuite;
it is required only when you use metrics and scorers;addedmetrics.flat_precision_score.0.3.2 (2015-12-18)Ignore more errors inFileResource.__del__.0.3.1 (2015-12-17)Ignore errors inFileResource.__del__.0.3 (2015-12-17)Addedsklearn_crfsuite.metrics.sequence_accuracy_score()function and
relatedsklearn_crfsuite.scorers.sequence_accuracy;FileResource.__del__method made more robust.0.2 (2015-12-11)backwards-incompatible:crf.taggerattribute is renamed tocrf.tagger_; when model is not trained accessing this attribute
no longer raises an exception, its value is set to None instead.new CRF attributes available after training:classes_size_num_attributes_attributes_state_features_transition_features_Tutorial is added.0.1 (2015-11-27)Initial release.
Package: sklearn-cv-pandas
sklearn-cv-pandasRandomizedSearchCV/GridSearchCV with pandas.DataFrame interfaceWhy do I want this?I usually prepare features as pandas.DataFrameScikit learn input should bearray-like.https://scikit-learn.org/stable/glossary.html#term-array-like.Although it includes pandas.DataFrame, there are some issues;It does not supportInt64data typeOutput model does not remember which columns should be usedSolutionProvide GridSearchCV / RandomizedSearchCV with pandas.DataFrame interfaceInternally preprocess DataFrame to be applicable for sklearnOutput offitcommand is now originalModelobject, whichstores column name informationprovides pandas.DataFrame interface for predictionInstallationpip install sklearn_cv_pandasUsageConfigure CV objectInstantiate CV in the same manner as original ones.from scipy import stats
from sklearn import linear_model
from sklearn_cv_pandas import RandomizedSearchCV

estimator = linear_model.Lasso()
param_dist = dict(alpha=stats.loguniform(1e-5, 10))
cv = RandomizedSearchCV(estimator, param_dist, scoring="mean_absolute_error")fitwith pandas.DataFrameOur CV object has new methodsfit_holdout_pandasandfit_cv_pandas.
Original ones requiresxandyasnumpy.array.
Instead of numpy array, you can specify onepandas.DataFrameand column names forx(feature_columns), and column name ofy(target_column).model = cv.fit_cv_pandas(
    df, target_column="y", feature_columns=["x{}".format(i) for i in range(100)], n_fold=5
)predictwith pandas.DataFrameYou can run prediction with pandas.DataFrame interface as well.
Output offit_holdout_pandasandfit_cv_pandasstoresfeature_columnsandtarget_column.
You can just inputpandas.DataFramefor prediction into the methodpredict.model.predict(df)
Package: sklearndf
sklearndfis an open source library designed to address a common need withscikit-learn: the outputs of
transformers are numpy arrays, even when the input is a
data frame. However, to inspect a model it is essential to keep track of the
feature names.To this end,sklearndfenhances scikit-learn’s estimators as follows:Preserve data frame structure:Return data frames as results of transformations, preserving feature names as the column index.Feature name tracing:Add additional estimator properties to enable tracing a feature name back to its original input feature; this is especially useful for transformers that create new features (e.g., one-hot encode), and for pipelines that include such transformers.Easy use:Simply append DF at the end of your usual scikit-learn class names to get enhanced data frame support!Licensesklearndfis licensed under Apache 2.0 as described in theLICENSEfile.
Package: sklearn-ensemble-cv
Ensemble-cross-validationsklearn_ensemble_cvis a Python module for performing accurate and efficient ensemble cross-validation methods from variousprojects.FeaturesThe module builds onscikit-learn/sklearnto provide the most flexibility on various base predictors.The module includes functions for creating ensembles of models, training the ensembles using cross-validation, and making predictions with the ensembles.The module also includes utilities for evaluating the performance of the ensembles and the individual models that make up the ensembles.fromsklearn.treeimportDecisionTreeRegressorfromsklearn_ensemble_cvimportECV# Hyperparameters for the base regressorgrid_regr={'max_depth':np.array([6,7],dtype=int),}# Hyperparameters for the ensemblegrid_ensemble={'max_features':np.array([0.9,1.]),'max_samples':np.array([0.6,0.7]),}# Build 50 trees and get estimates until 100 treesres_ecv,info_ecv=ECV(X_train,y_train,DecisionTreeRegressor,grid_regr,grid_ensemble,M=50,M_max=100,return_df=True)It currently supports bagging- and subagging-type ensembles under square loss.
The hyperparameters of the base predictor are listed atsklearn.tree.DecisionTreeRegressorand the hyperparameters of the ensemble are listed atsklearn.ensemble.BaggingRegressor.
Using other sklearn Regressors (regr.is_regressor = True) as base predictors is also supported.Cross-validation methodsThis project is currently in development. More CV methods will be added shortly.split CVK-fold CVECVGCVCGCVCGCV non-square lossALOCVUsageCheck out Jupyter Notebookdemo.ipynbabout how to apply ECV/CGCV on risk estimation and hyperparameter tuning for ensemble learning.Thedocumentis available.MIT LicenseCopyright (c) 2023 Du JinhongPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Package: sklearn-esa
Get the required resourcesscp -rwebis@webislab40.medien.uni-weimar.de:/home/weci2587/projects/args-topic-modeling/resources .To run the ESA-script with all terms run:For normal ESA:./esa-all-terms.py  --similarity cos
                    --matrix-path <path_to_resources>/resources/esa-plain/<debatepedia|strategic-intelligence|wikipedia>.mat
                    --model-path <path_to_resources>/resources/esa-w2v/GoogleNews-vectors-negative300.bin
                    --model-vocab <path_to_resources>/resources/esa-w2v/w2v-vocab.p
                    --input-path <path_to_input_file>
                    --output-path <path_to_output_file>For word2vec-ESA:./esa-all-terms.py  --similarity max
                    --matrix-path <path_to_resources>/resources/esa-w2v/<debatepedia|strategic-intelligence|wikipedia>.mat
                    --model-path <path_to_resources>/resources/esa-w2v/GoogleNews-vectors-negative300.bin
                    --model-vocab <path_to_resources>/resources/esa-w2v/w2v-vocab.p
                    --input-path <path_to_input_file>
                    --output-path <path_to_output_file>To run the word2vec-ESA with reduced terms run:./esa-top-n-terms.py    -n <number_of_terms> 
                        --corpus-path <path_to_resources>/resources/corpora/<debatepedia|strategic-intelligence|wikipedia>.csv
                        --model-path <path_to_resources>/resources/esa-w2v/GoogleNews-vectors-negative300.bin
                        --model-vocab <path_to_resources>/resources/esa-w2v/w2v-vocab.p
                        --input-path <path_to_input_file>
                        --output-path <path_to_output_file>The input document must be a csv file with "|" as the separator and must contain the column "document", which is used as the input text for the ESA.
Package: sklearn-fracdiff
sklearn-fracdiffUsagefromsklearn_fracdiffimportFracDiffobj=FracDiff(order=0.7)obj.fit(X)Z=obj.transform(X)Check theexamplesfolder
for notebooks.AppendixInstallationThesklearn-fracdiffgit
repois available asPyPi
packagepip install sklearn-fracdiff
pip install git+ssh://git@github.com/ulf1/sklearn-fracdiff.gitInstall a virtual environmentpython3.6 -m venv .venv
source .venv/bin/activate
pip3 install --upgrade pip
pip3 install -r requirements.txt(If your git repo is stored in a folder with whitespaces, then don’t use
the subfolder.venv. Use an absolute path without whitespaces.)Python commandsJupyter for the examples:jupyter labCheck syntax:flake8--ignore=F401--exclude=$(grep-v'^#'.gitignore | xargs | sed-e's//,/g')Run Unit Tests:pytestPublishpandocREADME.md--frommarkdown--torst-s-oREADME.rstpythonsetup.pysdisttwineupload-rpypidist/*Clean upfind . -type f -name "*.pyc" | xargs rm
find . -type d -name "__pycache__" | xargs rm -r
rm -r .venvSupportPleaseopen an
issuefor
support.ContributingPlease contribute usingGithub
Flow. Create a branch,
add commits, andopen a pull
request.
Package: sklearnFunctions
sklearnFunctions - eleka12This package is built on top of functions which are mostly required in a Data processing lifecycle.As of now This package contains a function which can remove outliers present in the DatasetMore number of functions will be added...How to use sklearnFunctionsinstall the latest packagein jupyter notebook -!pip install sklearnFunctionsin command prompt -pipinstallsklearnFunctionsNow run below snippets of code in your jupyter-notebooks / python projectImporting sklearnFunctionsfromsklearnFunctions.preprocessingimportoutliersThe input for the outlier function must be in DataFrameold_df=pd.DataFrame({"X":xvals,"Y":yvals})Checking for outliers | .is_present() function will return a percentage of outlier present in each columnoutliers().is_present(old_df)Removing outliers from DataFrame | .outliers_removal() function will remove all the outliers present in DataFramenew_df=outliers().outliers_removal(old_df)pypi repo link -mongoops - PYPIGithub repo link -mongoops - Github
Package: sklearn-genetic
sklearn-geneticsklearn-geneticis a genetic feature selection module for scikit-learn.Genetic algorithms mimic the process of natural selection to search for optimal values of a function.InstallationDependenciessklearn-genetic requires:Python (>= 3.7)scikit-learn (>= 1.0)deap (>= 1.0.2)numpymultiprocessUser installationThe easiest way to install sklearn-genetic is usingpippipinstallsklearn-geneticorcondacondainstall-cconda-forgesklearn-geneticDocumentationInstallation documentation, API reference and examples can be found on thedocumentation.See alsoshapicant, a feature selection package based on SHAP and target permutation, for pandas and Spark
Package: sklearn-hierarchical-classification
sklearn-hierarchical-classificationHierarchical classification module based on scikit-learn's interfaces and conventions.See the GitHub Pages hosted documentationhere.InstallationTo install, simply install this package via pip into your desired virtualenv, e.g:pip install sklearn-hierarchical-classificationUsageSeeexamples/for usage examples.Jupyter notebooksSupport for interactive development is built in to theHierarchicalClassifierclass. This will enable progress bars (using the excellenttqdmlibrary) in various places during training and may otherwise enable more visibility into the classifier which is useful during interactive use. To enable this make sure widget extensions are enabled by running:jupyter nbextension enable --py --sys-prefix widgetsnbextensionYou can then instantiate a classifier with theprogress_wrapperparameter set totqdm_notebook:clf=HierarchicalClassifier(base_estimator=svm.LinearSVC(),class_hierarchy=class_hierarchy,progress_wrapper=tqdm_notebook,)DocumentationAuto-generated documentation is provided via sphinx. To build / view:$ cd docs/
$ make html
$ open build/html/index.htmlDocumentation is published to GitHub pages from thegh-pagesbranch.
If you are a contributor and need to update documentation, a good starting point for getting setup isthis tutorial.Further Readingthis module is heavily influenced by the following previous work and papers:"Functional Annotation of Genes Using Hierarchical Text Categorization"- Kiritchenko et al. 2005"Classifying web documents in a hierarchy of categories: a comprehensive study"- Ceci and Malerba 2007"A survey of hierarchical classification across different application domains"- CN Silla et al. 2011"A Survey of Automated Hierarchical Classification of Patents"- JC Gomez et al. 2014"Evaluation Measures for Hierarchical Classification: a unified view and novel approaches"- Kosmopoulos et al. 2013"Bayesian Aggregation for Hierarchical Classification"- Barutcuoglu et al. 2008"Kaggle LSHTC4 Winning Solution"- Puurula et al. 2014"Feature-Weighted Linear Stacking"- Sill et al. 2009
Package: sklearning
This module is used to get metrics of Machine Learning/Deep Learning Models.It consists of all sklearn.metrics and stats module methods.Using this module you can also use all all different distances obtained in metrics.pairwise.cosine_distance etc.from sklearning.metrics import *y_test = [0,1,2,3,4]y_pred = [0,1,2,3,5]#Root Mean Squared Errorrmse = rootMeanSquaredError(y_test,y_pred)print(rmse)o/p:0.4472135954999579#Regressor Summarysummary = regressorSummary(y_test,y_pred)print(summary)#Stats ValuestatsValue(y_test,y_pred)o/p:statsValue(y_test,y_pred)pvalues[0.53047777 0.00190127]tvalues[-0.70710678 10.39230485]rsquared0.972972972972973rsquared_adj0.963963963963964#All methods of sklean.metrics can be used by just giving the name of methods ex:mse = mean_squared_error(y_test,y_pred)print(mse)o/p: 0.2