0 purchases
tensorflowml 1.1.3.2
tensorflow-ml
Introduction
TensorFlow 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.
Status
This project is currently under development. The following table shows the status of the implemented machine learning models:
Model
Type
Code
Test
Linear Regression
Regression
Done
Pass
Logistic Regression
Classification
Done
Pass
NB - GNB/BNB
Classification
Done
Pass
Random Forest/GBT/CART
Classification
Done
Pass
Lasso Regression
Regression
Done
Pass
Polynomial Reg
Regression
Done
Pass
Ridge Regression
Regression
Done
Pass
The following table shows the status of working status on different operating systems:
Operating System
Status
Linux
Pass
MacOS
In Progress
Windows
TBC
Installing
You can install TensorFlow ML from PyPI using pip. Follow these steps:
pip install tensorflow-ml
Alternatively, to use TensorFlow ML from GitHub directly, follow these steps:
Clone the GitHub repository: git clone https://github.com/siddhantpathakk/tensorflow-ml.git
Install the required dependencies by running: pip install -r requirements.txt
After 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.
Examples
Here are some examples of how to use TensorFlow ML to create machine learning models:
REGRESSION:
Linear Regression (Regular, Polynomial, Ridge, Lasso)
from tensorflow_ml.regression.linear import LinearRegression
# 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 LassoRegression
lr = LinearRegression()
# Set the hyper-parameters such as learning-rate, number of epochs etc
lr.set_params(_params)
# Train the model
lr.fit(x, y)
# Get the MSE
lr.evaluate(x, y)
# Get the predictions
lr.predict(x)
# Get the R-squared value
lr.score(x, y)
# Get the coefficients of the trained model
lr.get_coeff()
CLASSIFICATION:
Logistic Regression
from tensorflow_ml.classification.logistic_regression import LogisticRegression
logistic_regression = LogisticRegression()
# Set the hyper-parameters such as learning-rate, number of epochs etc
logistic_regression.set_params(params)
# Train the model
logistic_regression.fit(X_train, y_train, random_seed=42, X_val=X_val, y_val=y_val)
# Evaluate the model on the test set
accuracy, cross_entropy_loss = logistic_regression.score(X_test, y_test)
Naive Bayes Classifier (Bernoulli NB, Gaussian NB)
from tensorflow_ml.classification.naive_bayes.bernoulli import BernoulliNaiveBayes
# Set some additional hyper-parameters
bnb = BernoulliNaiveBayes(smoothing=1.0) # Set the desired smoothing parameter
# Train the model
bnb.fit(training_features, training_labels)
# Get the accuracy of the model on test set
accuracy = bnb.evaluate(testing_features, testing_labels)
Random Forests, Gradient Boosted Trees
from tensorflow_ml.classification.decision_tree import DecisionTree
model = 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 model
model.get_params()
# Load the dataset and convert it to TFDS
model.load_dataset(data, label)
# Train the model
model.fit(_metrics = ['mse', 'accuracy'])
# Evaluate the model and view metrics and loss
model.evaluate()
# Make predictions on test/train split of data
model.predict(length=5, split="test")
Participate in Contributing to this Repo
We 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-ml
Create a new branch for your feature/bugfix: git checkout -b feature-name
Implement 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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.