What does the last () in a function mean in Python?

(Since the question is almost inexperienced, there may be some inadequacies in the way you ask ...

〇 Question content In Python, for example rgs=linear_model.LinearRegression() Is the understanding that declares an object called rgs. What does the last () mean?

〇 Background

from sklearn import linear_model rgs=linear_model.LinearRegression rgs.fit(train_X, train_Y) print(rgs.coef_) print(rgs.intercept_)

I wrote the code, and the following error occurred.


TypeError Traceback (most recent call last) in 1 from sklearn import linear_model 2 rgs=linear_model.LinearRegression ----> 3 rgs.fit(train_X, train_Y) 4 print(rgs.coef_) 5 print(rgs.intercept_)

TypeError: fit() missing 1 required positional argument: 'y'

In conclusion, the second line of code rgs=linear_model.LinearRegression() If so, no error occurred and the correct result was obtained, but I'm not sure why it happened ... I'm sorry that the question is hard to see, but I would appreciate it if you could answer! Thank you.

Recommended Posts

What does the last () in a function mean in Python?
Get the caller of a function in Python
Create a function in Python
[Python] Make the function a lambda function
How to get the last (last) value in a list in Python
Precautions when pickling a function in python
Write the test in a python docstring
OR the List in Python (zip function)
Delete a particular character in Python if it is the last
Run the Python interpreter in a script
What is "mahjong" in the Python library? ??
A function that measures the processing time of a method in python
Python> Python does not include the last offset
The eval () function that calculates a string as an expression in python
What is the fastest way to create a reverse dictionary in python?
Draw a graph of a quadratic function in Python
[Python] Get the files in a folder with Python
What is wheezy in the Docker Python image?
Make a copy of the list in Python
Output in the form of a python array
I implemented the inverse gamma function in python
[Python] Find the transposed matrix in a comprehension
python xlwings: Find the cell in the last row
Various ways to read the last line of a csv file in Python
Check if the string is a number in python
A reminder about the implementation of recommendations in Python
How to unit test a function containing the current time using freezegun in python
python note: What does it mean to set a seed with random number generation?
What to do if Python does not switch from the System version in pyenv
Take a screenshot in Python
Create a dictionary in Python
Download the file in Python
Use callback function in Python
What is the activation function?
Find the difference in Python
ntile (decile) function in python
About the enumerate function (python)
Make a bookmarklet in Python
Nonlinear function modeling in Python
Draw implicit function in python
Immediate function in python (lie)
Draw a heart in Python
What I learned in Python
What is a callback function?
What is the Callback function?
What is a python map?
Find out the apparent width of a string in python
Create a local scope in Python without polluting the namespace
A function that divides iterable into N pieces in Python
How to use the __call__ method in a Python class
Have the equation graph of the linear function drawn in Python
Get the number of specific elements in a python list
[Note] Import of a file in the parent directory in Python
To return char * in a callback function using ctypes in Python
[MQTT / Python] Implemented a class that does MQTT Pub / Sub in Python
[python] Manage functions in a dictionary (command table, function table, function pointer)
A memo of writing a basic function in Python using recursion
Try running a function written in Python using Fn Project
Google search for the last line of the file in Python
Find the eigenvalues of a real symmetric matrix in Python
[C / C ++] Pass the value calculated in C / C ++ to a python function to execute the process, and use that value in C / C ++.