Posts

Random Forest - Python Code

 import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score,classification_report data = {     'CGPA': ['>=9', '<9', '>=9', '<9', '>=9'],     'Interactivity': ['Yes', 'No', 'No', 'No', 'Yes'],     'Comm': ['Good', 'Moderate', 'Moderate', 'Moderate', 'Moderate'],     'Practical': ['Good', 'Good', 'Average', 'Average', 'Average'],     'JobOffer': ['Yes', 'No', 'Yes', 'No', 'Yes'] } df=pd.DataFrame(data) df.replace({'>=9':1,'<9':0,'Yes':1,'No':0,'Good':1,'Moderate':0,'Average':0},inplace=True) X=df.drop('JobOffer',axis=1) y=df['JobOffer'] X_train,X_test,y...

ID3 - Python Code

 import pandas as pd import matplotlib.pyplot as plt from sklearn import tree from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score data = {     'Outlook': ['Sunny', 'Sunny', 'Overcast', 'Rain', 'Rain', 'Rain', 'Overcast',                 'Sunny', 'Sunny', 'Rain', 'Sunny', 'Overcast', 'Overcast', 'Rain'],     'Temperature': ['Hot', 'Hot', 'Hot', 'Mild', 'Cool', 'Cool', 'Cool',                     'Mild', 'Cool', 'Mild', 'Mild', 'Mild', 'Hot', 'Mild'],     'Humidity': ['High', 'High', 'High', 'High', 'Normal', 'Normal', 'Normal',                  'High', 'Normal', 'Normal', ...

Perceptron for AND Gate - Python Code

 import numpy as np def step(x):     return 1 if x>=0 else 0 def train(X,y):     w=np.zeros(X.shape[1])     b=0     for _ in range(5):         print(f'Epoch : {_}')         for i in range(len(X)):             z=np.dot(X[i],w)+b             y_pred=step(z)             error=y[i]-y_pred             w+=error*X[i]             b+=error         print(f'Weights : {w}, Bias : {b}')     return w,b def predict(X,w,b):     return [step(np.dot(x,w)+b) for x in X]  X=np.array([[0,0], [0,1], [1,0], [1,1]]) y=np.array([0,0,0,1]) w,b=train(X,y) print("Prediction:", predict(X,w,b))

Multiple Linear Regression - Python Code

import numpy as np import matplotlib.pyplot as plt X=np.array([[1,4],[2,5],[3,8],[4,2]]) Y=np.array([1,6,8,12]) X_bias=np.hstack((np.ones((X.shape[0],1)),X)) beta=np.linalg.inv(X_bias.T.dot(X_bias)).dot(X_bias.T).dot(Y) Y_pred=X_bias.dot(beta) print("Predicted values:",Y_pred) plt.scatter(Y,Y_pred,color='blue',label='Predicted vs Actual') #plt.plot(Y,Y,color='red',linestyle='--',label='Ideal Fit') plt.plot(Y,Y,'r--',label='Ideal Fit') plt.xlabel('Actual X') plt.ylabel('Actual Y') plt.title('Multiple Linear Regression') plt.legend() plt.grid(True) plt.show()

Simple Linear Regression - Python Code

 import numpy as np import matplotlib.pyplot as plt x=np.array([1,2,3,4,5]) y=np.array([1.2,1.8,2.6,3.2,3.8]) xmean=np.mean(x) ymean=np.mean(y) nr=np.sum((x-xmean)*(y-ymean)) dr=np.sum((x-xmean) ** 2) b1=nr/dr b0=ymean-b1*xmean print(f"Estimated coefficients : b0={b0},b1={b1}") ypred_line=b0+b1*x print(f"y_predicted_line : {ypred_line}") print('Prediction for x=7') x_new=7 ypred_new=b0+b1*x_new print(f"Prediction for x :{x_new}, y:{ypred_new}") plt.scatter(x,y,color='blue',label='Original Data') plt.plot(x,ypred_line,color='red',label='Regression Line') plt.xlabel('x') plt.ylabel('y') plt.title('Simple Linear Regression') plt.legend() plt.grid(True) plt.show()

5 Stages of Group Development

Image
  Five model stages can improve a new team become effective more quickly. Forming stage  is a situation that members of a group don’t truly understand about their duty, regulations and rules.  The members cannot finish their job without leader or manager because they lack of confidence.  They have to be encouraged and motivate them that it can help them to feel as a significant part of a team. Storming stage  is a situation that it often starts when team members prefer to use conflicting work styles. People may work in different ways for all sorts of reasons, but if differing working styles cause unforeseen problems, they may become frustrated.  Moving from this stage requires that the leader of team should strong ability to help all members accept each other and respect in each individual task. Norming   stage is a period that  team members know one-another better, they may socialize together, and they are able to ask each other fo...

HSDPA (High-Speed Downlink Packet Access)

Image
HSDPA, short for High-Speed Downlink Packet Access, is a new protocol for mobile telephone data transmision. It is known as a 3.5G technology. This standard will provide download speed on a mobile device equivalant to ADSL(Asymmetric Digital Subscriber Line) line in a home. HSDPA is an evolution or improvement on W-CDMA (Wideband Code Division Multiple Access), a 3G protocol. HSDPA improves the data tranfer rate by a factor of at least five over W-CDMA. Theoretical data transmission speed of HSDPA is 8 to 10 Mbps. HSDPA provide higher data transfer speeds and capacity with networks based on Universal Mobile Telecommunications System (UMTS). In India any BSNL(Bharat Sanchar Nigam Ltd) 3G coverage area, the network is based on UMTS and it support HSDPA. For HSDPA, a new transport layer channel, High-Speed Downlink Shared Channel (HS-DSCH), has been added to W-CDMA. It is implemented by adding three new physical layer channels: (i) HS-SCCH (High Speed-Shared Control Channel) (ii) HS-DPCCH...