Created
June 1, 2021 12:59
-
-
Save Pawandeep-prog/4b05937d17e827c2cec9871d8afafa85 to your computer and use it in GitHub Desktop.
This file contains 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 pandas as pd | |
import numpy as np | |
from sklearn.linear_model import LinearRegression | |
import matplotlib.pyplot as plt | |
df = np.load('archive/olivetti_faces.npy') | |
df = df.reshape(400, 64*64) | |
y = np.random.randn(40000).reshape(400,100) | |
reg = LinearRegression().fit(y, df) | |
reg.score(y, df) | |
plt.imshow(df[np.random.randint(1, 400)].reshape(64,64), cmap='gray') | |
plt.show() | |
inp = np.random.randn(100).reshape(1,-1) | |
pred = reg.predict(inp) | |
plt.imshow(pred.reshape(64,64), cmap='gray') | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
face generation using linear Regression
just did for fun while learning