Skip to content

Instantly share code, notes, and snippets.

View ksdkamesh99's full-sized avatar
💻
Sleep-Code-Eat

Kota Kamesh ksdkamesh99

💻
Sleep-Code-Eat
View GitHub Profile
# Create a tflite model object from TFLite Converter
tfmodel = converter.convert()
# Save TFLite model into a .tflite file
open("degree.tflite","wb").write(tfmodel)
# We need to create a TFLite Converter Object from model we created
converter = tensorflow.lite.TFLiteConverter.from_keras_model(model=model)
# Import tensorflow library
import tensorflow
#Save the model to saved_model.pbtxt
tensorflow.keras.models.save_model(model,'saved_model.pbtxt')
# 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])
'''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()
#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()
# 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()
# 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
%%time
y_pred_torch=model_torch.predict(np.array(x_test))
%%time
model_torch.to('cuda')