Skip to content

Commit 9f415c9

Browse files
author
Siddhant Pathak
authored
Merge pull request #16 from siddhantpathakk/development
Development
2 parents 35d0a6f + fc1e1fd commit 9f415c9

File tree

8 files changed

+228
-13
lines changed

8 files changed

+228
-13
lines changed

.DS_Store

8 KB
Binary file not shown.

docs/about.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## About the package
2+
3+
The TensorFlow ML project is useful for several reasons and can overcome the needs of scikit-learn in various scenarios:
4+
5+
1. **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.
6+
2. **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.
7+
3. **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.
8+
4. **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.
9+
5. **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.
10+
11+
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.

docs/class.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Classification
2+
3+
::: classification.naive_bayes.gaussian
4+
handler: python
5+
options:
6+
show_root_heading: true
7+
show_source: false
8+
heading_level: 2
9+
---------------------------------------
10+
::: classification.naive_bayes.bernoulli
11+
handler: python
12+
options:
13+
show_root_heading: true
14+
show_source: false
15+
heading_level: 2
16+
---------------------------------------
17+
::: classification.logistic_regression
18+
handler: python
19+
options:
20+
show_root_heading: true
21+
show_source: false
22+
heading_level: 2
23+
---------------------------------------
24+
:::classification.decision_tree
25+
handler: python
26+
options:
27+
show_root_heading: true
28+
show_source: false
29+
heading_level: 2

docs/index.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
1-
# Welcome to MkDocs
1+
# Tensorflow ML
22

3-
For full documentation visit [mkdocs.org](https://www.mkdocs.org).
3+
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.
44

5-
## Commands
5+
## Getting started
66

7-
* `mkdocs new [dir-name]` - Create a new project.
8-
* `mkdocs serve` - Start the live-reloading docs server.
9-
* `mkdocs build` - Build the documentation site.
10-
* `mkdocs -h` - Print help message and exit.
7+
You can install TensorFlow ML from PyPI using `pip`. Follow these steps:
118

12-
## Project layout
9+
```bash
10+
pip install tensorflow-ml
11+
```
1312

14-
mkdocs.yml # The configuration file.
15-
docs/
16-
index.md # The documentation homepage.
17-
... # Other markdown pages, images and other files.
13+
Alternatively, to use TensorFlow ML from GitHub directly, follow these steps:
14+
15+
1. Clone the GitHub repository: `git clone https://github.com/siddhantpathakk/tensorflow-ml.git`
16+
2. Install the required dependencies by running: `pip install -r requirements.txt`
17+
18+
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.
19+
20+
## Participate in Contributing
21+
22+
We welcome contributions from the open-source community to enhance the TensorFlow ML library. If you are interested in contributing, follow these steps:
23+
24+
1. Fork the project on GitHub: [https://github.com/siddhantpathakk/tensorflow-ml](https://github.com/your_username/tensorflow-ml)
25+
2. Create a new branch for your feature/bugfix: `git checkout -b feature-name`
26+
3. Implement your changes and improvements.
27+
4. Write tests to ensure the functionality of the added models.
28+
5. Commit your changes and push them to your forked repository.
29+
6. Create a pull request to the main repository, describing your changes in detail.
30+
31+
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!

docs/reg.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Regression
2+
3+
::: regression.linear
4+
handler: python
5+
options:
6+
show_root_heading: true
7+
show_source: false
8+
heading_level: 2
9+
---------------------------------------
10+
::: regression.lasso
11+
handler: python
12+
options:
13+
show_root_heading: true
14+
show_source: false
15+
heading_level: 2
16+
---------------------------------------
17+
::: regression.ridge
18+
handler: python
19+
options:
20+
show_root_heading: true
21+
show_source: false
22+
heading_level: 2
23+
---------------------------------------
24+
::: regression.polynomial
25+
handler: python
26+
options:
27+
show_root_heading: true
28+
show_source: false
29+
heading_level: 2

docs/status.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Status
2+
3+
This project is currently under development. The following table shows the status of the implemented machine learning models:
4+
5+
| Model | Type | Code | Test |
6+
| ---------------------- | -------------- | ---- | ---- |
7+
| Linear Regression | Regression | Done | Pass |
8+
| Logistic Regression | Classification | Done | Pass |
9+
| NB - GNB/BNB | Classification | Done | Pass |
10+
| Random Forest/GBT/CART | Classification | Done | Pass |
11+
| Lasso Regression | Regression | Done | Pass |
12+
| Polynomial Reg | Regression | Done | Pass |
13+
| Ridge Regression | Regression | Done | Pass |
14+
15+
The following table shows the status of working status on different operating systems:
16+
17+
| Operating System | Status |
18+
| ---------------- | ----------- |
19+
| Linux | Pass |
20+
| MacOS | In Progress |
21+
| Windows | TBC |

docs/tutorials.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
## Tutorials
2+
3+
Here are some examples of how to use TensorFlow ML to create machine learning models:
4+
5+
**REGRESSION:**
6+
7+
* Linear Regression (Regular, Polynomial, Ridge, Lasso)
8+
9+
```python
10+
from tensorflow_ml.regression.linear import LinearRegression
11+
12+
# Try other regression models if you feel like!
13+
# from tensorflow_ml.regression.polynomial import PolynomialRegression
14+
# from tensorflow_ml.regression.ridge import RidgeRegression
15+
# from tensorflow_ml.regression.lasso import LassoRegression
16+
17+
lr = LinearRegression()
18+
19+
# Set the hyper-parameters such as learning-rate, number of epochs etc
20+
lr.set_params(_params)
21+
22+
# Train the model
23+
lr.fit(x, y)
24+
25+
# Get the MSE
26+
lr.evaluate(x, y)
27+
28+
# Get the predictions
29+
lr.predict(x)
30+
31+
# Get the R-squared value
32+
lr.score(x, y)
33+
34+
# Get the coefficients of the trained model
35+
lr.get_coeff()
36+
```
37+
38+
**CLASSIFICATION:**
39+
40+
* Logistic Regression
41+
42+
```python
43+
from tensorflow_ml.classification.logistic_regression import LogisticRegression
44+
logistic_regression = LogisticRegression()
45+
46+
# Set the hyper-parameters such as learning-rate, number of epochs etc
47+
logistic_regression.set_params(params)
48+
49+
# Train the model
50+
logistic_regression.fit(X_train, y_train, random_seed=42, X_val=X_val, y_val=y_val)
51+
52+
# Evaluate the model on the test set
53+
accuracy, cross_entropy_loss = logistic_regression.score(X_test, y_test)
54+
```
55+
56+
* Naive Bayes Classifier (Bernoulli NB, Gaussian NB)
57+
58+
```python
59+
from tensorflow_ml.classification.naive_bayes.bernoulli import BernoulliNaiveBayes
60+
61+
# Set some additional hyper-parameters
62+
bnb = BernoulliNaiveBayes(smoothing=1.0) # Set the desired smoothing parameter
63+
64+
# Train the model
65+
bnb.fit(training_features, training_labels)
66+
67+
# Get the accuracy of the model on test set
68+
accuracy = bnb.evaluate(testing_features, testing_labels)
69+
```
70+
71+
* Random Forests, Gradient Boosted Trees
72+
73+
```python
74+
from tensorflow_ml.classification.decision_tree import DecisionTree
75+
76+
model = DecisionTree(model = "gbt", verbose = True) # Also can use 'rf' for Random Forests, 'cart' for Classification and Regression Tree
77+
78+
# If regression:
79+
model = DecisionTree(model = "gbt", verbose = True, _task = 'regression')
80+
81+
# Get the parameters pre-defined by the model
82+
model.get_params()
83+
84+
# Load the dataset and convert it to TFDS
85+
model.load_dataset(data, label)
86+
87+
# Train the model
88+
model.fit(_metrics = ['mse', 'accuracy'])
89+
90+
# Evaluate the model and view metrics and loss
91+
model.evaluate()
92+
93+
# Make predictions on test/train split of data
94+
model.predict(length=5, split="test")
95+
```

mkdocs.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
site_name: My Docs
1+
site_name: Tensorflow ML
2+
3+
nav:
4+
- Home: index.md
5+
- Support: status.md
6+
- Regression : reg.md
7+
- Classification : class.md
8+
- Tutorials: tutorials.md
9+
- About: about.md
10+
11+
theme: readthedocs
12+
13+
plugins:
14+
- mkdocstrings:
15+
handlers:
16+
python:
17+
paths: [tensorflow_ml] # search packages in the src folder

0 commit comments

Comments
 (0)