+ 1
I have problems in machine learning project "Bob the builder" here's my code. I am not expert in python I know only basics so -
So I can't tell what's wrong with this Here's my code import pandas as pd 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()] datapoint = [float(x) for x in input().split()] model = LogisticRegression() model.fit(X,y) print(model.predict(datapoint))
8 odpowiedzi
+ 1
The issue in your code is that the list comprehension for collecting data points in the variable `X` is incomplete. It lacks the expression that should be appended to the list `X`.
+ 5
Girish Sahu You cannot call the input so many times in the for loop, only you call one time and then build a for loop.
The best way to see how the data see is to print it, or a small part of it.
+ 4
Could you present the task description?
+ 3
JaScript Task
You are given a feature matrix and a single datapoint to predict. Your job will be to build a Logistic Regression model with the feature matrix and make a prediction (1 or 0) of the single datapoint.
Input Format
First line: Number of data points in the feature matrix (n)
Next n lines: Values of the row in the feature matrix, separated by spaces
Next line: Target values separated by spaces
Final line: Values (separated by spaces) of a single datapoint without a target value
+ 3
Wilbur Jaywright that was mistaken I fixed that
+ 3
In addition to the above mentioned will be needed the datapoint to reshape.
+ 2
Why do you have the datapoint line twice?
+ 2
I think I should learn how to convert that n variable into array and acces last elements