mirror of
https://github.com/gmihaila/ml_things.git
synced 2021-10-04 01:29:04 +03:00
removed unnecessary folder & update README.md
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,3 +1,8 @@
|
||||
.idea/
|
||||
.DS_Store
|
||||
__pycache__/
|
||||
/build/
|
||||
/dist/
|
||||
/ml_things.egg-info/
|
||||
/notebookc.egg-info/
|
||||
/src/ml_things.egg-info/
|
||||
|
||||
43
README.md
43
README.md
@@ -1,10 +1,39 @@
|
||||
## Contains things I find usefull in my Mahcine Learning work
|
||||
|
||||
## Something not working?/Found somthing fishy? Open an issue please!
|
||||
|
||||
When writing the issue mention what file are you having problems running and the actual error/problem.
|
||||
<h3 align="center">
|
||||
<p>Machine Learning Things
|
||||
</h3>
|
||||
|
||||
|
||||
</br>
|
||||
<p align="center">
|
||||
<br>
|
||||
<img src="https://previews.123rf.com/images/djvstock/djvstock1609/djvstock160900168/62105361-laptop-gear-tools-developer-web-responsive-development-website-programming-icon-set-colorful-design-.jpg" width="300"/>
|
||||
<br>
|
||||
<p>
|
||||
|
||||
[]()
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
[]()
|
||||
[]()
|
||||
|
||||
**Machine Learning Things (ml_things)** is a lightweight python library that contains functions and code snippets that
|
||||
I use in my everyday research with Machine Learning, Deep Learning, NLP.
|
||||
|
||||
I created this repo because I was tired of always looking up same code from older projects.
|
||||
By making this available to everyone it gives me easy access to some code I use frequently but also make it available for others in my situation.
|
||||
If you find any issues please feel free to open an issue.
|
||||
|
||||
This library also contains Python code snippets that can speed up Machine Learning workflow.
|
||||
|
||||
## Installation
|
||||
|
||||
I tested this repo with Python 3.6+.
|
||||
|
||||
It's always good practice to install `ml_things` in a [virtual environment](https://docs.python.org/3/library/venv.html). If you guidance on using Python's virtual environments you can check out the user guide [here](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).
|
||||
|
||||
You can install `ml_things` with pip from GitHub:
|
||||
|
||||
```bash
|
||||
pip install git+https://github.com/gmihaila/ml_things
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
[Learning Tensorflow 2.0+](https://github.com/gmihaila/machine_learning_things/tree/master/learning_tensorflow)
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# flake8: noqa
|
||||
|
||||
__version__ = "0.0.1"
|
||||
|
||||
# functions
|
||||
from .ml_things import convert
|
||||
from .padding import pad_numpy
|
||||
@@ -1,10 +0,0 @@
|
||||
def convert(my_name):
|
||||
"""
|
||||
Print a line about converting a notebook.
|
||||
Args:
|
||||
my_name (str): person's name
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
|
||||
print(f"I'll convert a notebook for you some day, {my_name}.")
|
||||
@@ -1,104 +0,0 @@
|
||||
# coding=utf-8
|
||||
# Copyright 2020 George Mihaila.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""Padding lists in Python to even length Numpy array"""
|
||||
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
def pad_numpy(variable_length_array, fixed_length=None, axis=1):
|
||||
"""Pad variable length array to a fixed numpy array.
|
||||
It can handle single arrays [1,2,3] or nested arrays [[1,2],[3]].
|
||||
Args:
|
||||
variable_length_array: Single arrays [1,2,3] or nested arrays [[1,2],[3]].
|
||||
fixed_length: max length of rows for numpy.
|
||||
axis: directions along rows: 1 or columns: 0
|
||||
|
||||
Returns:
|
||||
numpy_array: axis=1: fixed numpy array shape [len of array, fixed_length].
|
||||
axis=0: fixed numpy array shape [fixed_length, len of array].
|
||||
|
||||
Unittest using `doctest`:
|
||||
>>> pad_numpy([1,2,3], 2, 0)
|
||||
array([[1., 2., 3.],
|
||||
[0., 0., 0.]])
|
||||
>>> pad_numpy([[1,2],[3,4]], 3, 0)
|
||||
array([[1., 2.],
|
||||
[3., 4.],
|
||||
[0., 0.]])
|
||||
>>> pad_numpy([1,2,3], 2, 1)
|
||||
array([1., 2.])
|
||||
>>> pad_numpy([[1,2],[3,4]], 3, 1)
|
||||
array([[1., 2., 0.],
|
||||
[3., 4., 0.]])
|
||||
"""
|
||||
|
||||
if axis not in [1, 0]:
|
||||
# axis value is wrong
|
||||
raise ValueError("`axis` value needs to be 1 for row padding \
|
||||
or 0 for column padding!")
|
||||
|
||||
# find fixed_length if no value given
|
||||
fixed_length = max([len(row) for row in variable_length_array]) if fixed_length is None else fixed_length
|
||||
|
||||
# array of arrays
|
||||
if isinstance(variable_length_array[0], list) or isinstance(
|
||||
variable_length_array[0], np.ndarray):
|
||||
|
||||
if axis == 1:
|
||||
# perform pading on rows
|
||||
numpy_array = np.zeros((len(variable_length_array), fixed_length))
|
||||
# verify each row
|
||||
for numpy_row, array_row in zip(numpy_array, variable_length_array):
|
||||
# concatenate array row if it is longer
|
||||
array_row = array_row[:fixed_length]
|
||||
numpy_row[:len(array_row)] = array_row
|
||||
|
||||
elif axis == 0:
|
||||
# make sure all rows have same length
|
||||
if not all([len(row)==len(variable_length_array[0]) \
|
||||
for row in variable_length_array]):
|
||||
raise ValueError("`variable_length_array` need to have same row length for column padding `axis=0`!")
|
||||
# padding on columns
|
||||
if fixed_length >= len(variable_length_array):
|
||||
# need to padd
|
||||
numpy_array = np.zeros((fixed_length, len(variable_length_array[0])))
|
||||
numpy_array[:len(variable_length_array)] = variable_length_array
|
||||
else:
|
||||
# need to cut array
|
||||
numpy_array = np.array(variable_length_array[:fixed_length])
|
||||
|
||||
return numpy_array
|
||||
|
||||
# array of values
|
||||
elif isinstance(variable_length_array, list) or isinstance(
|
||||
variable_length_array, np.ndarray):
|
||||
|
||||
if axis == 1:
|
||||
# perform pading on rows
|
||||
numpy_array = np.zeros(fixed_length)
|
||||
variable_length_array = variable_length_array[:fixed_length]
|
||||
numpy_array[:len(variable_length_array)] = variable_length_array
|
||||
|
||||
elif axis == 0:
|
||||
# padding on columns
|
||||
numpy_array = np.zeros((fixed_length, len(variable_length_array)))
|
||||
numpy_array[0] = variable_length_array
|
||||
|
||||
return numpy_array
|
||||
|
||||
else:
|
||||
# array is not a valid format
|
||||
raise ValueError("`variable_length_array` is not a valid format.")
|
||||
BIN
dist/ml_things-0.0.1-py3-none-any.whl
vendored
BIN
dist/ml_things-0.0.1-py3-none-any.whl
vendored
Binary file not shown.
BIN
dist/ml_things-0.0.1.tar.gz
vendored
BIN
dist/ml_things-0.0.1.tar.gz
vendored
Binary file not shown.
BIN
dist/notebookc-0.0.1-py3-none-any.whl
vendored
BIN
dist/notebookc-0.0.1-py3-none-any.whl
vendored
Binary file not shown.
BIN
dist/notebookc-0.0.1.tar.gz
vendored
BIN
dist/notebookc-0.0.1.tar.gz
vendored
Binary file not shown.
@@ -1,23 +0,0 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: ml-things
|
||||
Version: 0.0.1
|
||||
Summary: A package to keep all helping functions used in Machine Learning together
|
||||
Home-page: https://github.com/gmihaila/ml_things
|
||||
Author: George Mihaila
|
||||
Author-email: georgemihaila@my.unt.edu
|
||||
License: UNKNOWN
|
||||
Description: ## Contains things I find usefull in my Mahcine Learning work
|
||||
|
||||
## Something not working?/Found somthing fishy? Open an issue please!
|
||||
|
||||
When writing the issue mention what file are you having problems running and the actual error/problem.
|
||||
|
||||
|
||||
</br>
|
||||
|
||||
[Learning Tensorflow 2.0+](https://github.com/gmihaila/machine_learning_things/tree/master/learning_tensorflow)
|
||||
|
||||
Platform: UNKNOWN
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: License :: MIT License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
||||
Description-Content-Type: text/markdown
|
||||
@@ -1,9 +0,0 @@
|
||||
README.md
|
||||
ml_things
|
||||
setup.py
|
||||
ml_things/__init__.py
|
||||
ml_things/ml_things.py
|
||||
ml_things.egg-info/PKG-INFO
|
||||
ml_things.egg-info/SOURCES.txt
|
||||
ml_things.egg-info/dependency_links.txt
|
||||
ml_things.egg-info/top_level.txt
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
ml_things
|
||||
@@ -1,23 +0,0 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: notebookc
|
||||
Version: 0.0.1
|
||||
Summary: A package to convert your Jupyter Notebook
|
||||
Home-page: https://github.com/your_package/homepage/
|
||||
Author: Jeff Hale
|
||||
Author-email: jeffmshale@gmail.com
|
||||
License: UNKNOWN
|
||||
Description: ## Contains things I find usefull in my Mahcine Learning work
|
||||
|
||||
## Something not working?/Found somthing fishy? Open an issue please!
|
||||
|
||||
When writing the issue mention what file are you having problems running and the actual error/problem.
|
||||
|
||||
|
||||
</br>
|
||||
|
||||
[Learning Tensorflow 2.0+](https://github.com/gmihaila/machine_learning_things/tree/master/learning_tensorflow)
|
||||
|
||||
Platform: UNKNOWN
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
||||
Description-Content-Type: text/markdown
|
||||
@@ -1,9 +0,0 @@
|
||||
README.md
|
||||
setup.py
|
||||
ml_things/__init__.py
|
||||
ml_things/ml_things.py
|
||||
notebookc.egg-info/PKG-INFO
|
||||
notebookc.egg-info/SOURCES.txt
|
||||
notebookc.egg-info/dependency_links.txt
|
||||
notebookc.egg-info/requires.txt
|
||||
notebookc.egg-info/top_level.txt
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
ipython>=6
|
||||
nbformat>=4
|
||||
nbconvert>=5
|
||||
requests>=2
|
||||
@@ -1 +0,0 @@
|
||||
ml_things
|
||||
@@ -1 +0,0 @@
|
||||
numpy==1.19.1
|
||||
@@ -1,33 +0,0 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: ml-things
|
||||
Version: 0.0.1
|
||||
Summary: Useful functions when working with Machine Learning in Python
|
||||
Home-page: https://github.com/gmihaila/ml_things
|
||||
Author: George Mihaila
|
||||
Author-email: georgemihaila@my.unt.edu
|
||||
License: Apache
|
||||
Description: ## Contains things I find usefull in my Mahcine Learning work
|
||||
|
||||
## Something not working?/Found somthing fishy? Open an issue please!
|
||||
|
||||
When writing the issue mention what file are you having problems running and the actual error/problem.
|
||||
|
||||
|
||||
</br>
|
||||
|
||||
[Learning Tensorflow 2.0+](https://github.com/gmihaila/machine_learning_things/tree/master/learning_tensorflow)
|
||||
|
||||
Keywords: NLP deep learning pytorch tensorflow numpy
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Intended Audience :: Education
|
||||
Classifier: Intended Audience :: Science/Research
|
||||
Classifier: License :: OSI Approved :: Apache Software License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
||||
Requires-Python: >=3.6.0
|
||||
Description-Content-Type: text/markdown
|
||||
@@ -1,10 +0,0 @@
|
||||
README.md
|
||||
setup.py
|
||||
src/ml_things/__init__.py
|
||||
src/ml_things/ml_things.py
|
||||
src/ml_things/padding.py
|
||||
src/ml_things.egg-info/PKG-INFO
|
||||
src/ml_things.egg-info/SOURCES.txt
|
||||
src/ml_things.egg-info/dependency_links.txt
|
||||
src/ml_things.egg-info/requires.txt
|
||||
src/ml_things.egg-info/top_level.txt
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
numpy
|
||||
requests
|
||||
tqdm>=4.27
|
||||
@@ -1 +0,0 @@
|
||||
ml_things
|
||||
Reference in New Issue
Block a user