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
# Create a tflite model object from TFLite Converter | |
tfmodel = converter.convert() | |
# Save TFLite model into a .tflite file | |
open("degree.tflite","wb").write(tfmodel) |
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
# We need to create a TFLite Converter Object from model we created | |
converter = tensorflow.lite.TFLiteConverter.from_keras_model(model=model) |
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 tensorflow library | |
import tensorflow | |
#Save the model to saved_model.pbtxt | |
tensorflow.keras.models.save_model(model,'saved_model.pbtxt') |
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 the tensorflow libraries which are used to create a sequential model and add a dense layer | |
import tensorflow as tf | |
import numpy as np | |
from tensorflow.python.keras.models import Sequential | |
from tensorflow.python.keras.layers import Dense | |
# Create random arrays x1,y1 as training data | |
x1=np.array([50,100,150,200,250,300,350]) |
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
'''If we want to divide our data frame into 2 parts one belongs to setosa | |
and other belongs to other than setosa you need to add a boolean series with dataframe | |
equal to setosa and mention the names in compare_intra() function | |
''' | |
compare_intra_report=sv.compare_intra(train,train['species']=='Iris-setosa',['setosa','other']) | |
# If you want to display the report then use show_html function | |
compare_intra_report.show_html() |
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
#We use compare function to do EDA Comparision between 2 dataframes i.e train,test | |
compare_report=sv.compare(train,test) | |
# To display the analysis of this report you need to use show_html() from sweetviz library | |
compare_report.show_html() |
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
# analyze the train dataframe using analyze() function | |
report=sv.analyze(train) | |
# To display the analysis of this dataframe you need to use show_html() from sweetviz library | |
report.show_html() |
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 sweetviz and pandas libraries | |
import sweetviz as sv | |
import pandas as pd | |
# Now read the dataset using pd.read_csv() function | |
data = pd.read_csv('IRIS.csv') | |
# Split first 125 entries/rows into train data frame |
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
%%time | |
y_pred_torch=model_torch.predict(np.array(x_test)) |
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
%%time | |
model_torch.to('cuda') |