Skip to main content

Posts

Showing posts with the label Python

CNN(Convolutional Neural Network) - Machine Learning - part 2

We have understood basics of CNN in detail in my  previous post  post now this is time to write our own code and start create our own CNN model. Please have a look on below images to understand high level CNN architecture. We shown in picture we need multiple layers in CNN so we will create multiple layers for different purpose. So let's start writing code - First layer - Convolution layer Second layer - pooling layer (For minimize the size) Third layer - Flatten layer (To convert data from 2D to 1D) Fourth layer - Dense layer (For neural network) from keras.layers import Convolution2D from keras.layers import MaxPooling2D from keras.layers import Flatten from keras.layers import Dense model = Sequential() model.add(Convolution2D(filters=32,  kernel_size=(3,3),  activation='relu',  input_shape=(64,64,3)  ) ) model.summary() Model: "sequential_3" _________________________________________________________________ Layer (type) ...

CNN(Convolutional Neural Network) - Machine Learning - part 1

  We have studied lots of things about traditional(old) ML and DL but if we would like to summarize our learning then we can say that ML learning is approach to find correct weight and  bias , but biggest difficulty to find correct  weight  and  bias is to find correct feature. Because weight and bias both are dependent of correct feature.   So finally we want a correct feature. Also I have written multiple posts on feature selection approach. But in short if data is small(small data means number of rows can be any number but number of columns are limited) we can use manual approach for feature selection and it can be done using traditional ML. But if we have Big Data(Big Data mean unlimited number of columns) we can't select feature manually and it is impossible. So for this we have new machine learning approach which is known as DL(Deep learning). In deep learning NN(Neural Network) help to select features automatically.   One of great example o...

Create dynamic and interactive graphs using plotly & cufflinks

  As we know visuals are best of data analysis for humans. So if we want to do data analysis in machine learning using python, then there are lots of libraries(plot using pandas, matplotlib, folium, seaborn) are available to create graphs, but if we just looking for graphs then we can draw the graphs but these graphs are very static.   That means we can't create dynamic graphs using these libraries. If requirement is to create dynamic graphs then we have to move on another libraries like plotly & cufflinks. import plotly.graph_objs as go import plotly.offline as pyo datax = np.random.randint(1,101,100) datay = np.random.randint(1,101,100) datax,datay (array([66, 80, 27, 7, 76, 82, 75, 97, 80, 10, 2, 53, 97, 84, 29, 3, 99, 10, 59, 75, 21, 27, 93, 64, 96, 63, 78, 89, 16, 80, 35, 39, 32, 33, 46, 26, 59, 60, 70, 9, 72, 51, 23, 32, 49, 92, 74, 49, 7, 89, 90, 48, 75, 94, 82, 24, 7, 81, 11, 12, 86, 47, 47, 70, 76, 9, 92, 8, ...

MLOps Day17

Next to MLOps Day16 post :-   We have completed data cleaning process in previous post  and today we will move ahead to create a binary classification model using logistic regression approach.   Now first of all we will have to find our y(target) and X(predictors). Since we are trying to find survived or not so Survived column will be our y  and and there can be multiple X so here feature selection comes into the picture. There are multiple techniques of feature selection are available and few out of them are listed in starting posts of this series. Since I watched " Titanic" movie and heard lots of thing about titanic ship hence here I'll move with domain expert approach. Using domain expert I I find out my features and these are  Pclass,  Sex,  Age,  SibSp,  Parch,  Embarked.  A passenger is survived or not it is not at all dependent on  PassengerId, Name,  Ticket,  Fare.  That's why these are not my f...

MLOps Day16

Binary Classification :- If you want to predict something and output of it is to be happen or not(0/1) this kind of problem solved under Binary classification. For this we use an algorithms/models is Sigmoid . To solve binary classification problems we use sklearn , sklearn call logistic regression and logistic regression internally use Sigmoid function. Hypothesis - Creating a model is also known a hypothesis. Today I am going to analysis ' Titanic ' passenger data set, and try to create a model and try predict something so that what we can do in future to avoid such casualties. Any data which has category is categorical data, doesn't matter if it contains integer or string. import pandas as pd dataset = pd.read_csv('train.csv') dataset.head() dataset.info() <class 'pandas.core.frame.DataFrame'> RangeIndex: 891 entries, 0 to 890 Data columns (total 12 columns): # Column Non-Null Count Dtype --- ------ --------...