0
Machine learn-Bob the builder
i solved the first 4 test cases ,but the last 2 failed and its hidden. can you help me to fix the last 2 cases ,and not sending me a new one? Thank you. n = int(input()) X = [] for i in range(n): X.append([float(x) for x in input().split()]) y = [int(x) for x in input().split()] datapoint = [float(x) for x in input().split()] from sklearn.linear_model import LogisticRegression import pandas as pd model=LogisticRegression() model.fit(X,y) X.append(datapoint) df=pd.DataFrame(X,columns=['xAxis','yAxis']) x=df.values y_pred=model.predict(x) print(y_pred[n])
1 Odpowiedź
+ 1
delete import pandas.. line and all lines after model.fit ...and this is the print
print(model.predict([datapoint])[0])
......................
from sklearn.linear_model import LogisticRegression
n = int(input())
X = []
for i in range(n):
X.append([float(x) for x in input().split()])
y = [int(x) for x in input().split()]
datapoint = [float(x) for x in input().split()]
model = LogisticRegression()
model.fit(X, y)
print(model.predict([datapoint])[0])