a.
import pandas as pd
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
t = pd.DataFrame({"l" : [3,3,1], "b" : [1,3,3], "op":['S',"L","L"] })
X = t.iloc[:,0:-1]
Y = t.iloc[:,-1]
for k in (1,2,3):
knn = KNeighborsClassifier(n_neighbors=k).fit(X,Y)
print("predicted size is" ,knn.predict([[1.5,3]])[0])
predicted size is L predicted size is L predicted size is L
b.
import pandas as pd
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
t = pd.DataFrame({"l" : [3,3,1], "b" : [1,3,3], "op":['L',"S","S"] })
X = t.iloc[:,0:-1]
Y = t.iloc[:,-1]
for k in (1,2,3):
knn = KNeighborsClassifier(n_neighbors=k).fit(X,Y)
print("predicted size is" ,knn.predict([[1.5,3]])[0])
predicted size is S predicted size is S predicted size is S
7.3 Consider a set of three records with two numeric fields X, and Y. Type is the categorical tar...
Need help with stats true or false questions Decide (with short explanations) whether the following statements are true or false a) We consider the model y-Ao +A(z) +E. Let (-0.01, 1.5) be a 95% confidence interval for A In this case, a t-test with significance level 1% rejects the null hypothesis Ho : A-0 against a two sided alternative. b) Complicated models with a lot of parameters are better for prediction then simple models with just a few parameters c)...
Question 2 : Virus Wars A popular subgenre of strategy game is the so-called Virus War format, where the player is shown a field of cells, each with a virus count, and may attack other cells within a certain range. We are going to write some classes in Python to implement a simple Virus Wars game. 2a) The position class (9 points) Everything within this game is going to require a position, so it makes sense to define it up...
Consider a cylindrical capacitor like that shown in Fig. 24.6. Let d = rb − ra be the spacing between the inner and outer conductors. (a) Let the radii of the two conductors be only slightly different, so that d << ra. Show that the result derived in Example 24.4 (Section 24.1) for the capacitance of a cylindrical capacitor then reduces to Eq. (24.2), the equation for the capacitance of a parallel-plate capacitor, with A being the surface area of...
Chapter overview 1. Reasons for international trade Resources reasons Economic reasons Other reasons 2. Difference between international trade and domestic trade More complex context More difficult and risky Higher management skills required 3. Basic concept s relating to international trade Visible trade & invisible trade Favorable trade & unfavorable trade General trade system & special trade system Volume of international trade & quantum of international trade Commodity composition of international trade Geographical composition of international trade Degree / ratio of...