Posts

environment creation on python

  without conda : D:\Anney\environment>python -m venv magic_venv D:\Anney\environment>.\magic_venv\Scripts\activate (magic_venv) D:\Anney\environment> environment  conda: $ conda create --name [Virtual Environment Name] python=[Version you want to install] Example, $ conda create --name sample_venv python= 3.8  

Rock_paper Scissor

 

Pcb Fault Detection(Deep Learning Technique)

  Hello,  that's how I applied my deep Learning skills to my electronics industry  application Technical except After iterating through many models we find this model to be giving good accuracy and least loss. we used  #yolo  v5 with 4000 epoch. here us the latest update to the dataset. I have gathered data related to pcb fault detection. I have gathered a huge amount of image data. and I have open sourced it via-Kaggle. feel free to explore it.

AI_gym_assistent

 

what is good dataset?

Image
    First things first, we need  to learn how to identify good data set! .I can make it easy for you  acronyms:                                                                            R-O-C-C-C                                                                                                                        R for reliable.       Like a good friend, good data sources are ...

image clustering technique using Kmeans

Image
 Kmeans algorithm is widely used to cluster image i.e grouping the image as per the color.  Kmeans basically use the technique to form a cluster by making decision boundry the code below will help you to get the proper grip on the idea. code import numpy as np import cv2 import matplotlib.pyplot as plt original_image = cv2.imread("/content/sample_data/ocen.png") original_image this few lines is importing essential lib. and uploading the image to see the cluster image of it. img=cv2.cvtColor(original_image,cv2.COLOR_BGR2RGB) #Next, converts the MxNx3 image into a Kx3 matrix where K=MxN and each row is now a vector in the 3-D space of RGB. vectorized = img.reshape(( -1 , 3 )) #We convert the unit8 values to float as it is a requirement of the k-means method of OpenCV. vect...

whats the difference between insert and append ? with python code.

"insert" and "append" method in list in Python bigginer basically get confused when to use insert and append method in list. heras is the very simple understanding format of  it.   insert: to add some element in the list at certain position. append: to add element in the list. code: append ................................................................................................................... shop=['bread','banana','egg'] shop.append("apple") print(shop) output: ['bread', 'banana', 'egg', 'apple'] ..................................................................... insert: python code: shop.insert(2,"lemmon") shop output: ['bread', 'banana', 'lemmon', 'egg', 'apple']  

lest just create a basic bot operation in python

 hers the code ....................................python code ...................................................................... name=(input("whats your name :")) print("hello",name) ans=(input("have you thought of black hole today: say yess or no!")) print("iam so glad you said {}, I was thinking the same thing".format(ans)) ........................................................................................................................ output: whats your name :animesh hello animesh have you thought of black hole today: say yess or no!yess! iam so glad you said yess!, I was thinking the same thing hears another: ...........................................python code .......................................................................... #print("how intillegenat are you in the range of 0-10?:") x=(int(input("how intillegenat are you in the range of 0-10?:"))) if (x>=5 and x<=10):     print("you are in...

rock paper scisor game

for the exact code: https://github.com/animeesh/game-rock-paper-scissor code  random lib is used to get the random value  import random #input_list = ["Rock", "Paper", "Scissor"] while True:     input_user = input("Select the input: ")     print (input_user)      possible_action=["rock","paper","scissor"]     computer_action=random.choice(possible_action)          print(f"\nyou chose :{input_user},computer chose :{computer_action}.\n")     #hear starts the real technique     if input_user ==computer_action:         print(f"both player selected {input_user}.hence its a tie!")     elif input_user== "rock":         if computer_action=="scissor":             print("rock smashes scissor! you win")         else:             print("paper covers the rock! you lose") ...

using your age and duration of workout finding how much calories you burned!

dataset: https://www.kaggle.com/fmendes/fmendesdat263xdemos/download ......................................................................................................................................................... import pandas as  pd import matplotlib.pyplot as plt import numpy as np import pickle  from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression df_calories=pd.read_csv("ineuron/calories.csv") df_exercise=pd.read_csv("ineuron/exercise.csv") data=df_exercise.merge(df_calories, on='User_ID') #print(data.head()) #[:,0:-1] all rows and all expect last column (independent  variable) also feature column #data_x = data.iloc[:,:-1].values data_x= df.loc[:,[ 'Weight','Age','Duration']] data_y=df.iloc[:,-1] #[:,-1]all rows and only last column (dependent variable) also target column #data_y = data.iloc[:,-1].values x_train,x_test,y_train,y_test = train_test_split(data_x,data_y,test...

Logestic Regression

In [18]: import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split df = pd . read_csv ( "framingham_heart_disease.csv" ) df . head () Out[18]: male age education currentSmoker cigsPerDay BPMeds prevalentStroke prevalentHyp diabetes totChol sysBP diaBP BMI heartRate glucose TenYearCHD 0 1 39 4.0 0 0.0 0.0 0 0 0 195.0 106.0 70.0 26.97 80.0 77.0 0 1 0 46 2.0 0 0.0 0.0 0 0 0 250.0 121.0 81.0 28.73 95.0 76.0 0 2 1 48 1.0 1 20.0 0.0 0 0 0 245.0 127.5 80.0 25.34 75.0 70.0 0 3 0 61 3.0 1 30.0 0.0 0 1 0 225.0 150.0 95.0 28.58 65.0 103.0 1 4 0 46 3.0 1 23.0 0.0 0 0 0 285.0 130.0 84.0 23.10 85.0 85.0 0 In [5]: df . describe () Out[5]: male age education currentSmoker cigsPerDay BPMeds prevalentStroke prevalentHyp diabetes totChol sysBP diaBP BMI heartRate glucose TenYearCHD count 4238.000000 4238.000000 4133.000000 4238.000000 4209.000000 4185.000000 4238.000000 4238.000000 4238.000000 4188.000000 423...

Project 3:Movie Recomendation using python

Image
Basicly there are two types of recomendation system  content based filtering colaborative filtering you can google out this and get to know about it i am here basicly to put down the projects and code so all what we do is predict the movie for the  customer using the angular distance (we can calculate using two method ie. euclidian diatance and angular distance) according to the problem you have to decide which one will be suitable for the project i think this much description is ell and good lets cary on with the codes so are you ready? this is the basic code to get the matrix of the text realation ,i mean the realtion between the words in  two sentence. from  sklearn.feature_extraction.text  import  CountVectorizer from  sklearn.metrics.pairwise  import  cosine_similarity text=[ "London Paris London" , "Paris Paris London" ] cv=CountVectorizer() cv_matrix=cv.fit_transform(text) #print(cv_matrix.toarray()) similirity_scor...

Project 2: pdf extractor using python

Image
let us prepare a project of few codes to extract the whole pdf    import pip install PyPDF2 code: ............................................................................................................................................. from PyPDF2 import PdfFileReader #read a pdf file ie. by rb mode file=open("Handbook.pdf",'rb') #reader ia s variable use to read file  reader=PdfFileReader(file) #lets get the info of the pdf document print("document info:",reader.getDocumentInfo()) print() #getNumPages() this comand can get you page numbers of pdf print("number pf pages are:",reader.getNumPages()) #lets take variable "pages" to take comand over get number of pages pages=reader.getNumPages() for i in range(0,pages):     print("page number=",i+1)     pageObj = reader.getPage(i)     print(pageObj.extractText()) print() print(reader.getDocumentInfo().creator) file.close() ............................................................

k nearest neighbors with well defined k value

Image
 so let us understand how we can chooose the perfect k for our model  from the last model i had prepared a function def regression(model):     x_train,x_test,y_train,y_test= train_test_split(x,y,test_size=0.2)     reg_all=model     reg_all.fit(x_train,y_train)     y_predict=reg_all.predict(x_test)     rmse_value=np.sqrt(mean_squared_error(y_test,y_predict))     print("rms error={}".format(rmse_value)) i have prepared cross value squared to get the mean of rmse where k=3 denote the mean of three iterated value of rmse Lasso is a way to conterect over fitting (we can also use ridge) to check. from sklearn.model_selection import cross_val_score from sklearn.linear_model import Lasso def regression_cv(model,k=3):     scores=cross_val_score(model,x,y,scoring='neg_mean_squared_error',cv=k)     rmse=np.sqrt(-scores)     print('reg rmse:',rmse)     print('reg mean:',rmse.mean()) importi...

Packt publication linear regression

code: ''' step1: import all the required packages step2: read the csv file and deop the null value step3: declare x & y ie. independent and target vallue step4:split train and test values from the data set step5:call Linear regression and fit x & y train value step6: predict y for our x value from test value and find rmse value rmse value can be usefull to undersand the effeciency of our model ''' import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error from sklearn.model_selection import train_test_split In [20]: df_housing . head () Out[20]: CRIM ZN INDUS CHAS NOX RM AGE DIS RAD TAX PTRATIO B LSTAT MEDV 0 0.00632 18.0 2.31 0 0.538 6.575 65.2 4.0900 1 296 35.3 396.9 4.98 24.00 1 0.02731 0.0 7.07 0 0.469 6.421 78.9 4.9671 2 242 17.8 396.9 9.14 21.60 2 0.02731 0.0 7.07 0 0.469 6.421 78.9 4.9671 2 242 17.8 396.9 9.14 21.61 3 0.02731 0.0 7.07 0 0.4...