| Name | mlektic JSON |
| Version |
0.0.6
JSON |
| download |
| home_page | None |
| Summary | A python machine learning library to use and visualize gradient descent for linear regression and logistic regression optimization. |
| upload_time | 2024-08-11 12:53:34 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.8 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Mlektic: A Simple and Efficient Machine Learning Library
Mlektic is a Python library built on top of TensorFlow, designed to simplify the implementation and experimentation with univariate/multivariate linear and logistic regression models. By providing a variety of gradient descent algorithms and regularization techniques, Mlektic enables both beginners and experienced practitioners to efficiently build, train, and evaluate regression models with minimal code.
<p align="center">
<img src="https://raw.githubusercontent.com/DanielDialektico/mlektic/main/files/desc-1.jpg" alt="mlektic" width="200">
</p>
## Key Features
- **Linear and Logistic Regression**: Easily implement and experiment with these fundamental machine learning models.
- **Gradient Descent Variants**: Choose from various gradient descent methods, including batch, stochastic, and mini-batch, to optimize your models.
- **Regularization Techniques**: Apply L1, L2, or elastic net regularization to improve model generalization and prevent overfitting.
- **DataFrame Compatibility**: Seamlessly integrate with Pandas and Polars DataFrames, allowing you to preprocess and manage your data effortlessly.
- **Cost Visualization**: Visualize the evolution of the cost function over time using dynamic or static plots, helping you better understand the training process.
- **Evaluation Metrics**: Access a range of evaluation metrics to assess the performance of both linear and logistic regression models, ensuring that your models meet your performance criteria.
- **User-Friendly API**: Designed with simplicity in mind, Mlektic's API is intuitive and easy to use, making it accessible for users with varying levels of expertise.
## When to Use Mlektic?
- **Educational Purposes**: Ideal for students and educators to demonstrate the principles of regression and gradient descent in a practical setting.
- **Prototyping and Experimentation**: Quickly prototype regression models and experiment with different optimization techniques without the overhead of more complex machine learning frameworks.
- **Small to Medium Scale Projects**: Perfect for small to medium-sized projects where ease of use and quick iteration are more important than handling large-scale data.
<p align="center">
<img src="https://raw.githubusercontent.com/DanielDialektico/mlektic/main/files/desc-2.jpg" alt="mlektic" width="200">
</p>
## Installation
You can install Mlektic using pip:
```sh
pip install mlektic
```
## Getting Started
To train a model using linear regression with standard gradient descent and L1 regularization:
```python
from mlektic.linear_reg import LinearRegressionArcht
from mlektic import preprocessing
from mlektic import methods
import pandas as pd
import numpy as np
# Generate random data.
np.random.seed(42)
n_samples = 100
feature1 = np.random.rand(n_samples)
feature2 = np.random.rand(n_samples)
target = 3 * feature1 + 5 * feature2 + np.random.randn(n_samples) * 0.5
# Create pandas dataframe from the data.
df = pd.DataFrame({
'feature1': feature1,
'feature2': feature2,
'target': target
})
# Create train and test sets.
train_set, test_set = preprocessing.pd_dataset(df, ['feature1', 'feature2'], 'target', 0.8)
# Define regulizer and optimizer.
regularizer = methods.regularizer_archt('l1', lambda_value=0.01)
optimizer = methods.optimizer_archt('sgd-standard')
# Configure the model.
lin_reg = LinearRegressionArcht(iterations=50, optimizer=optimizer, regularizer=regularizer)
# Train the model.
lin_reg.train(train_set)
```
```plaintext
Epoch 5, Loss: 15.191523551940918
Epoch 10, Loss: 11.642797470092773
Epoch 15, Loss: 9.021803855895996
Epoch 20, Loss: 7.08500862121582
Epoch 25, Loss: 5.652813911437988
Epoch 30, Loss: 4.592779636383057
Epoch 35, Loss: 3.807236909866333
Epoch 40, Loss: 3.2241621017456055
Epoch 45, Loss: 2.790440320968628
Epoch 50, Loss: 2.4669017791748047
```
The cost evolution can be plotted with:
```sh
from mlektic.plot_utils import plot_cost
cost_history = lin_reg.get_cost_history()
plot_cost(cost_history, dim = (7, 5))
```
<p>
<img src="https://raw.githubusercontent.com/DanielDialektico/mlektic/main/files/plot.jpg" alt="cost plot" width="500">
</p>
<br><br/>
You can replace `LinearRegressionArcht` with `LogisticRegressionArcht`, and try different types of optimizers and regularizers.
## Documentation
For more detailed information, including API references and advanced usage, please refer to the [full documentation](https://dialektico.com/mlektic/docs/).
## Contributing
Contributions are welcome! If you have suggestions for improvements, feel free to open an issue or send me an email to contacto@dialektico.com.
## License
Mlektic is licensed under the Apache 2.0 License. See the [LICENSE](https://github.com/DanielDialektico/mlektic/blob/main/LICENSE) file for more details.
Raw data
{
"_id": null,
"home_page": null,
"name": "mlektic",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Daniel Antonio Garc\u00eda Escobar <contacto@dialektico.com>",
"download_url": "https://files.pythonhosted.org/packages/c1/b2/5a3c36d81bae092b2489330fc4ea52eb29f28cc74143d940ee3da5ee6cb6/mlektic-0.0.6.tar.gz",
"platform": null,
"description": "# Mlektic: A Simple and Efficient Machine Learning Library\r\n\r\nMlektic is a Python library built on top of TensorFlow, designed to simplify the implementation and experimentation with univariate/multivariate linear and logistic regression models. By providing a variety of gradient descent algorithms and regularization techniques, Mlektic enables both beginners and experienced practitioners to efficiently build, train, and evaluate regression models with minimal code.\r\n<p align=\"center\">\r\n <img src=\"https://raw.githubusercontent.com/DanielDialektico/mlektic/main/files/desc-1.jpg\" alt=\"mlektic\" width=\"200\">\r\n</p>\r\n\r\n## Key Features\r\n\r\n- **Linear and Logistic Regression**: Easily implement and experiment with these fundamental machine learning models.\r\n- **Gradient Descent Variants**: Choose from various gradient descent methods, including batch, stochastic, and mini-batch, to optimize your models.\r\n- **Regularization Techniques**: Apply L1, L2, or elastic net regularization to improve model generalization and prevent overfitting.\r\n- **DataFrame Compatibility**: Seamlessly integrate with Pandas and Polars DataFrames, allowing you to preprocess and manage your data effortlessly.\r\n- **Cost Visualization**: Visualize the evolution of the cost function over time using dynamic or static plots, helping you better understand the training process.\r\n- **Evaluation Metrics**: Access a range of evaluation metrics to assess the performance of both linear and logistic regression models, ensuring that your models meet your performance criteria.\r\n- **User-Friendly API**: Designed with simplicity in mind, Mlektic's API is intuitive and easy to use, making it accessible for users with varying levels of expertise.\r\n\r\n## When to Use Mlektic?\r\n\r\n- **Educational Purposes**: Ideal for students and educators to demonstrate the principles of regression and gradient descent in a practical setting.\r\n- **Prototyping and Experimentation**: Quickly prototype regression models and experiment with different optimization techniques without the overhead of more complex machine learning frameworks.\r\n- **Small to Medium Scale Projects**: Perfect for small to medium-sized projects where ease of use and quick iteration are more important than handling large-scale data.\r\n<p align=\"center\">\r\n <img src=\"https://raw.githubusercontent.com/DanielDialektico/mlektic/main/files/desc-2.jpg\" alt=\"mlektic\" width=\"200\">\r\n</p>\r\n\r\n## Installation\r\n\r\nYou can install Mlektic using pip:\r\n\r\n```sh\r\npip install mlektic\r\n``` \r\n\r\n## Getting Started\r\nTo train a model using linear regression with standard gradient descent and L1 regularization:\r\n\r\n```python\r\n from mlektic.linear_reg import LinearRegressionArcht\r\n from mlektic import preprocessing\r\n from mlektic import methods\r\n import pandas as pd\r\n import numpy as np\r\n\r\n # Generate random data.\r\n np.random.seed(42)\r\n n_samples = 100\r\n feature1 = np.random.rand(n_samples)\r\n feature2 = np.random.rand(n_samples)\r\n target = 3 * feature1 + 5 * feature2 + np.random.randn(n_samples) * 0.5\r\n\r\n # Create pandas dataframe from the data.\r\n df = pd.DataFrame({\r\n 'feature1': feature1,\r\n 'feature2': feature2,\r\n 'target': target\r\n })\r\n\r\n # Create train and test sets.\r\n train_set, test_set = preprocessing.pd_dataset(df, ['feature1', 'feature2'], 'target', 0.8)\r\n\r\n # Define regulizer and optimizer.\r\n regularizer = methods.regularizer_archt('l1', lambda_value=0.01)\r\n optimizer = methods.optimizer_archt('sgd-standard')\r\n\r\n # Configure the model.\r\n lin_reg = LinearRegressionArcht(iterations=50, optimizer=optimizer, regularizer=regularizer)\r\n\r\n # Train the model.\r\n lin_reg.train(train_set)\r\n```\r\n```plaintext\r\n Epoch 5, Loss: 15.191523551940918\r\n Epoch 10, Loss: 11.642797470092773\r\n Epoch 15, Loss: 9.021803855895996\r\n Epoch 20, Loss: 7.08500862121582\r\n Epoch 25, Loss: 5.652813911437988\r\n Epoch 30, Loss: 4.592779636383057\r\n Epoch 35, Loss: 3.807236909866333\r\n Epoch 40, Loss: 3.2241621017456055\r\n Epoch 45, Loss: 2.790440320968628\r\n Epoch 50, Loss: 2.4669017791748047\r\n```\r\n\r\nThe cost evolution can be plotted with:\r\n```sh\r\n from mlektic.plot_utils import plot_cost\r\n\r\n cost_history = lin_reg.get_cost_history()\r\n plot_cost(cost_history, dim = (7, 5))\r\n```\r\n\r\n<p>\r\n <img src=\"https://raw.githubusercontent.com/DanielDialektico/mlektic/main/files/plot.jpg\" alt=\"cost plot\" width=\"500\">\r\n</p>\r\n<br><br/>\r\n\r\nYou can replace `LinearRegressionArcht` with `LogisticRegressionArcht`, and try different types of optimizers and regularizers.\r\n\r\n## Documentation\r\nFor more detailed information, including API references and advanced usage, please refer to the [full documentation](https://dialektico.com/mlektic/docs/).\r\n\r\n## Contributing\r\nContributions are welcome! If you have suggestions for improvements, feel free to open an issue or send me an email to contacto@dialektico.com.\r\n\r\n## License\r\nMlektic is licensed under the Apache 2.0 License. See the [LICENSE](https://github.com/DanielDialektico/mlektic/blob/main/LICENSE) file for more details. \r\n",
"bugtrack_url": null,
"license": null,
"summary": "A python machine learning library to use and visualize gradient descent for linear regression and logistic regression optimization.",
"version": "0.0.6",
"project_urls": {
"Documentation": "https://dialektico.com/mlektic/docs/",
"Source": "https://github.com/DanielDialektico/mlektic"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d5b2608fcaa6aac388ec6fdc6649a8050e20b80a69b53f3564886b4bfa1031b4",
"md5": "dc7d858ebd672da7c8679ed3610e22b6",
"sha256": "2483064a440eb660ba587e52055ff76df6fc2ee572e91a9cd2edf87f246687d4"
},
"downloads": -1,
"filename": "mlektic-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dc7d858ebd672da7c8679ed3610e22b6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 22920,
"upload_time": "2024-08-11T12:53:33",
"upload_time_iso_8601": "2024-08-11T12:53:33.297362Z",
"url": "https://files.pythonhosted.org/packages/d5/b2/608fcaa6aac388ec6fdc6649a8050e20b80a69b53f3564886b4bfa1031b4/mlektic-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c1b25a3c36d81bae092b2489330fc4ea52eb29f28cc74143d940ee3da5ee6cb6",
"md5": "93caa3ab8d64e01fbdfa5ccffed642d9",
"sha256": "7128adcab348d7365aa451b3f3bdd02bc534a2b09e26afadaf333338e67493e5"
},
"downloads": -1,
"filename": "mlektic-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "93caa3ab8d64e01fbdfa5ccffed642d9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 19569,
"upload_time": "2024-08-11T12:53:34",
"upload_time_iso_8601": "2024-08-11T12:53:34.761432Z",
"url": "https://files.pythonhosted.org/packages/c1/b2/5a3c36d81bae092b2489330fc4ea52eb29f28cc74143d940ee3da5ee6cb6/mlektic-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-11 12:53:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DanielDialektico",
"github_project": "mlektic",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mlektic"
}