import pandas as pd
from sklearn.datasets import fetch_openml
x = fetch_openml(data_id=1461, as_frame=True, parser='pandas')
dataset = x['frame']
print(f'dataset Shape {dataset.shape}')
dataset.head()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| # Frobenius norm (X) = Tr(X.X_T) X_T = Transpose of X | |
| # d(Frobenius norm)/dX = 2X | |
| # M ~ L*R | |
| # R = l*r - M | |
| # Loss_fuction = NORM(R) to be minimized | |
| # Loss_fuction = NORM(R) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| ### Loss function : L(w₁,w₂) = 0.75(w₁ −2)² + 0.35(w₂−4)² | |
| ### Gradient of Loss function : ∇ L = [0.75×2×(w₁ −2), 0.35×2×(w₂−4)]ᵀ | |
| ### Hyper Parameters : Learning Rate η = 0.1 , iteration or epoch N = 100 | |
| loss_f = lambda w1,w2: 0.75*(w1-2)**2 + 0.35*(w2-4)**2 | |
| grad_f = lambda w1,w2: np.array([1.5*(w1-2),0.7*(w2-4)]) | |
| eta, epoch = 0.1 ,100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| import os | |
| import pikepdf | |
| perser = argparse.ArgumentParser() | |
| perser.add_argument('Path', metavar='path', help='PDF directory') | |
| args = perser.parse_args() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Installation can be done pip install Jupyter. However big list dependency of Jupyter can be avoided by installting ipython kernel module only, if you have Jupyter installed Globally.
- Install the ipython kernrl
pip install ipykernel - Create a new kernel for your current virtual environment
python -m ipykernel install --user --name=<promt> - Launch the notebook with
jupyter notebbokfrom virtual Environment. - You should now be able to see your kernel in the IPython notebook menu: Kernel -> Change kernel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def make_pipeline2(list_of_callables): | |
| def map_2_partials(item): | |
| func = item[0] | |
| #return func if len(item) < 2 else partial(func, **item[1]) | |
| if len(item) < 2: | |
| return func | |
| else : | |
| return partial(func, **item[1]) | |
| list_of_partials = map(map_2_partials, list_of_callables) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import reduce | |
| # creates pipeline object from list of callables | |
| def make_pipeline(list_of_callables): | |
| return reduce(lambda f,g: lambda x: g(f(x)), list_of_callables) | |
| add1 = lambda x: x+'1' # Oprtaion 1 | |
| add2 = lambda x: x+'2' # Oprtaion 2 | |
| add3 = lambda x: x+'3' # Oprtaion 3 | |
| add4 = lambda x: x+'4' # Oprtaion 4 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
