Package: tensorflow-ml
tensorflow-mlIntroductionTensorFlow ML is a project that aims to provide an abstract implementation of commonly used machine learning algorithms using TensorFlow, without relying on external libraries like scikit-learn. This project is designed to offer a comprehensive and flexible set of machine learning models that can be used for various tasks, such as classification, regression, clustering, and more.The TensorFlow ML project is useful for several reasons and can overcome the needs of scikit-learn in various scenarios:TensorFlow Backend:By leveraging TensorFlow as its backend, TensorFlow ML can take advantage of its efficient computation and optimization capabilities. TensorFlow is well-known for its ability to work with large-scale datasets and efficiently utilize hardware accelerators like GPUs and TPUs, making it suitable for handling complex machine learning models and tasks.Flexibility and Customizability:With TensorFlow ML, users have the flexibility to customize and fine-tune machine learning models according to their specific needs. TensorFlow's symbolic representation and automatic differentiation capabilities enable easy modification of models, loss functions, and optimization algorithms. This level of customization may not always be readily available in pre-implemented models of scikit-learn.Continuous Development and Updates:As TensorFlow ML is an open-source project, it can benefit from a large community of contributors and developers. This means that the project is continually evolving, and new algorithms and improvements can be added regularly. This is especially advantageous for staying up-to-date with the latest advancements in machine learning.Unified Framework:By using TensorFlow ML, developers and researchers can work within a single framework for both traditional machine learning and deep learning tasks. This avoids the need to switch between different libraries and provides a more cohesive environment for developing and deploying machine learning models.Community and Support:TensorFlow has a large and active community of users and contributors. This means that users of TensorFlow ML can benefit from the collective knowledge and support of this community, which can be invaluable for troubleshooting, sharing best practices, and fostering collaborative development.StatusThis project is currently under development. The following table shows the status of the implemented machine learning models:ModelTypeCodeTestLinear RegressionRegressionDonePassLogistic RegressionClassificationDonePassNB - GNB/BNBClassificationDonePassRandom Forest/GBT/CARTClassificationDonePassLasso RegressionRegressionDonePassPolynomial RegRegressionDonePassRidge RegressionRegressionDonePassThe following table shows the status of working status on different operating systems:Operating SystemStatusLinuxPassMacOSIn ProgressWindowsTBCInstallingYou can install TensorFlow ML from PyPI usingpip. Follow these steps:pipinstalltensorflow-mlAlternatively, to use TensorFlow ML from GitHub directly, follow these steps:Clone the GitHub repository:git clone https://github.com/siddhantpathakk/tensorflow-ml.gitInstall the required dependencies by running:pip install -r requirements.txtAfter the installation is complete, you can import the implemented machine learning models in your Python scripts and start using TensorFlow ML for your machine learning tasks.ExamplesHere are some examples of how to use TensorFlow ML to create machine learning models:REGRESSION:Linear Regression (Regular, Polynomial, Ridge, Lasso)fromtensorflow_ml.regression.linearimportLinearRegression# Try other regression models if you feel like!# from tensorflow_ml.regression.polynomial import PolynomialRegression# from tensorflow_ml.regression.ridge import RidgeRegression# from tensorflow_ml.regression.lasso import LassoRegressionlr=LinearRegression()# Set the hyper-parameters such as learning-rate, number of epochs etclr.set_params(_params)# Train the modellr.fit(x,y)# Get the MSElr.evaluate(x,y)# Get the predictionslr.predict(x)# Get the R-squared valuelr.score(x,y)# Get the coefficients of the trained modellr.get_coeff()CLASSIFICATION:Logistic Regressionfromtensorflow_ml.classification.logistic_regressionimportLogisticRegressionlogistic_regression=LogisticRegression()# Set the hyper-parameters such as learning-rate, number of epochs etclogistic_regression.set_params(params)# Train the modellogistic_regression.fit(X_train,y_train,random_seed=42,X_val=X_val,y_val=y_val)# Evaluate the model on the test setaccuracy,cross_entropy_loss=logistic_regression.score(X_test,y_test)Naive Bayes Classifier (Bernoulli NB, Gaussian NB)fromtensorflow_ml.classification.naive_bayes.bernoulliimportBernoulliNaiveBayes# Set some additional hyper-parametersbnb=BernoulliNaiveBayes(smoothing=1.0)# Set the desired smoothing parameter# Train the modelbnb.fit(training_features,training_labels)# Get the accuracy of the model on test setaccuracy=bnb.evaluate(testing_features,testing_labels)Random Forests, Gradient Boosted Treesfromtensorflow_ml.classification.decision_treeimportDecisionTreemodel=DecisionTree(model="gbt",verbose=True)# Also can use 'rf' for Random Forests, 'cart' for Classification and Regression Tree# If regression:model=DecisionTree(model="gbt",verbose=True,_task='regression')# Get the parameters pre-defined by the modelmodel.get_params()# Load the dataset and convert it to TFDSmodel.load_dataset(data,label)# Train the modelmodel.fit(_metrics=['mse','accuracy'])# Evaluate the model and view metrics and lossmodel.evaluate()# Make predictions on test/train split of datamodel.predict(length=5,split="test")Participate in Contributing to this RepoWe welcome contributions from the open-source community to enhance the TensorFlow ML library. If you are interested in contributing, follow these steps:Fork the project on GitHub:https://github.com/siddhantpathakk/tensorflow-mlCreate a new branch for your feature/bugfix:git checkout -b feature-nameImplement your changes and improvements.Write tests to ensure the functionality of the added models.Commit your changes and push them to your forked repository.Create a pull request to the main repository, describing your changes in detail.Your contributions will be reviewed, and once approved, they will be merged into the main project. Let's work together to make TensorFlow ML a powerful and versatile machine learning library!In summary, TensorFlow ML is a powerful and versatile alternative to scikit-learn, providing users with a wide range of machine learning algorithms, seamless deep learning integration, customizability, and access to the rich TensorFlow ecosystem. Whether it's traditional machine learning or cutting-edge deep learning, TensorFlow ML has the potential to meet the diverse needs of machine learning practitioners and researchers.