microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.68k stars 771 forks source link

Cannot access member "named_steps" for type "BaseEstimator" #4432

Closed amroca79 closed 1 year ago

amroca79 commented 1 year ago

Environment data

Code Snippet

Input:

import pandas as pd 
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler, MinMaxScaler, MaxAbsScaler, RobustScaler, Normalizer
from sklearn.pipeline import Pipeline
from sklearn.model_selection import GridSearchCV, TimeSeriesSplit
import numpy as np

data = {'A': [10.0, 20.0, 30.0, 40.0, 50.0], 'B': [0.1, 0.5, 1.0, 1.5, 2.0], 'C': [1000.0, 2000.0, 3000.0, 4000.0, 5000.0]}
df = pd.DataFrame(data)
df

feature = np.array(df[['A','B']])
target = np.array(df[['C']])

scaler = [ StandardScaler(),
           MinMaxScaler(),
           RobustScaler(),
           MaxAbsScaler(),
           Normalizer()]

pipeline = Pipeline([
    ('scaler', None),
    ('model', LinearRegression())
])

param_grid = {
    'scaler': scaler,
    'model__copy_X': [True, False],
    'model__fit_intercept': [True, False]
}

grid_s = GridSearchCV(pipeline, param_grid=param_grid, cv=2)

tscv = TimeSeriesSplit(n_splits=2)

for train_index, test_index in tscv.split(feature, target):
    x_train, x_test = feature[train_index], feature[test_index]
    y_train, y_test = target[train_index], target[test_index]

grid_s.fit(x_train, y_train)

grid_s.best_estimator_.named_steps['scaler']

Output:

MaxAbsScaler()

Expected behavior

.named_steps execute without warning.

Actual behavior

.named_steps executes with warning.

Cannot access member "named_steps" for type "BaseEstimator" Member "named_steps" is unknownPylancereportGeneralTypeIssues (function) named_steps: Unknown

Logs

2023-05-30 21:37:34.967 [info] [Info  - 9:37:34 PM] (29120) Pylance language server 2023.5.40 (pyright e6d7b84c) starting
2023-05-30 21:37:34.967 [info] [Info  - 9:37:34 PM] (29120) Server root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist
2023-05-30 21:37:34.976 [info] [Info  - 9:37:34 PM] (29120) Starting service instance "DS_Projects"
2023-05-30 21:37:35.064 [info] [Info  - 9:37:35 PM] (29120) Setting pythonPath for service "DS_Projects": "C:\Users\amroc\anaconda3\python.exe"
2023-05-30 21:37:35.072 [info] [Warn  - 9:37:35 PM] (29120) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-30 21:37:35.270 [info] [Info  - 9:37:35 PM] (29120) Assuming Python version 3.10
2023-05-30 21:37:35.620 [info] [Info  - 9:37:35 PM] (29120) Found 1 source file
2023-05-30 21:37:35.653 [info] [Info  - 9:37:35 PM] (29120) Background analysis(1) root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist
2023-05-30 21:37:35.657 [info] [Info  - 9:37:35 PM] (29120) Background analysis(1) started
2023-05-30 21:37:35.660 [info] [Info  - 9:37:35 PM] (29120) Starting service instance "DS_Projects"
2023-05-30 21:37:35.677 [info] [Info  - 9:37:35 PM] (29120) Setting pythonPath for service "DS_Projects": "c:\Users\amroc\anaconda3\python.exe"
2023-05-30 21:37:35.677 [info] [Warn  - 9:37:35 PM] (29120) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-30 21:37:35.843 [info] [Info  - 9:37:35 PM] (29120) Assuming Python version 3.10
2023-05-30 21:37:36.142 [info] [Info  - 9:37:36 PM] (29120) Found 1 source file
2023-05-30 21:37:36.976 [info] [Info  - 9:37:36 PM] (29120) Background analysis(2) root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist
2023-05-30 21:37:36.976 [info] [Info  - 9:37:36 PM] (29120) Background analysis(2) started
2023-05-30 21:37:36.977 [info] [Info  - 9:37:36 PM] (29120) Indexer background runner(3) root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist (index)
2023-05-30 21:37:36.977 [info] [Info  - 9:37:36 PM] (29120) Indexing(3) started
2023-05-30 21:37:38.454 [info] [Info  - 9:37:38 PM] (29120) scanned(3) 311 files over 1 exec env
2023-05-30 21:37:43.037 [info] [Info  - 9:37:43 PM] (29120) [IDX(3)] Long operation: index execution environment c:\Users\amroc\OneDrive\Documents\DS_Projects (4438ms)
2023-05-30 21:37:43.040 [info] [Info  - 9:37:43 PM] (29120) [IDX(3)] Long operation: index packages c:\Users\amroc\OneDrive\Documents\DS_Projects (4452ms)
2023-05-30 21:37:43.040 [info] [Info  - 9:37:43 PM] (29120) indexed(3) 223 files over 1 exec env
2023-05-30 21:37:43.099 [info] [Info  - 9:37:43 PM] (29120) Indexing finished(3).
2023-05-30 21:42:11.919 [info] [Info  - 9:42:11 PM] (18208) Pylance language server 2023.5.40 (pyright e6d7b84c) starting
2023-05-30 21:42:11.920 [info] [Info  - 9:42:11 PM] (18208) Server root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist
2023-05-30 21:42:11.927 [info] [Info  - 9:42:11 PM] (18208) Starting service instance "DS_Projects"
2023-05-30 21:42:11.977 [info] [Info  - 9:42:11 PM] (18208) Setting pythonPath for service "DS_Projects": "C:\Users\amroc\anaconda3\python.exe"
2023-05-30 21:42:11.981 [info] [Warn  - 9:42:11 PM] (18208) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-30 21:42:12.100 [info] [Info  - 9:42:12 PM] (18208) Assuming Python version 3.10
2023-05-30 21:42:12.420 [info] [Info  - 9:42:12 PM] (18208) Found 1 source file
2023-05-30 21:42:12.458 [info] [Info  - 9:42:12 PM] (18208) Starting service instance "DS_Projects"
2023-05-30 21:42:12.469 [info] [Info  - 9:42:12 PM] (18208) Background analysis(1) root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist
2023-05-30 21:42:12.471 [info] [Info  - 9:42:12 PM] (18208) Background analysis(1) started
2023-05-30 21:42:12.480 [info] [Info  - 9:42:12 PM] (18208) Setting pythonPath for service "DS_Projects": "c:\Users\amroc\anaconda3\python.exe"
2023-05-30 21:42:12.480 [info] [Warn  - 9:42:12 PM] (18208) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-30 21:42:12.665 [info] [Info  - 9:42:12 PM] (18208) Assuming Python version 3.10
2023-05-30 21:42:12.964 [info] [Info  - 9:42:12 PM] (18208) Found 1 source file
2023-05-30 21:42:13.758 [info] [Info  - 9:42:13 PM] (18208) Background analysis(2) root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist
2023-05-30 21:42:13.758 [info] [Info  - 9:42:13 PM] (18208) Background analysis(2) started
2023-05-30 21:42:13.758 [info] [Info  - 9:42:13 PM] (18208) Indexer background runner(3) root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist (index)
2023-05-30 21:42:13.759 [info] [Info  - 9:42:13 PM] (18208) Indexing(3) started
2023-05-30 21:42:15.810 [info] [Info  - 9:42:15 PM] (18208) [IDX(3)] Long operation: scan packages c:\Users\amroc\OneDrive\Documents\DS_Projects (2126ms)
2023-05-30 21:42:15.810 [info] [Info  - 9:42:15 PM] (18208) scanned(3) 311 files over 1 exec env
2023-05-30 21:42:16.767 [info] [Info  - 9:42:16 PM] (18208) [BG(2)] Long operation: getSemanticTokens full at c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W0sZmlsZQ==.py (3232ms)
2023-05-30 21:42:21.635 [info] [Info  - 9:42:21 PM] (18208) [IDX(3)] Long operation: index execution environment c:\Users\amroc\OneDrive\Documents\DS_Projects (5669ms)
2023-05-30 21:42:21.637 [info] [Info  - 9:42:21 PM] (18208) [IDX(3)] Long operation: index packages c:\Users\amroc\OneDrive\Documents\DS_Projects (5684ms)
2023-05-30 21:42:21.638 [info] [Info  - 9:42:21 PM] (18208) indexed(3) 223 files over 1 exec env
2023-05-30 21:42:21.689 [info] [Info  - 9:42:21 PM] (18208) Indexing finished(3).
2023-05-31 00:13:50.599 [info] [Info  - 12:13:50 AM] (18208) Setting pythonPath for service "DS_Projects": "C:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:13:50.600 [info] [Warn  - 12:13:50 AM] (18208) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-31 00:13:50.746 [info] [Info  - 12:13:50 AM] (18208) Assuming Python version 3.10
2023-05-31 00:13:50.961 [info] [Info  - 12:13:50 AM] (18208) Found 1 source file
2023-05-31 00:13:50.972 [info] [Info  - 12:13:50 AM] (18208) Setting pythonPath for service "DS_Projects": "c:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:13:50.972 [info] [Warn  - 12:13:50 AM] (18208) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-31 00:13:51.072 [info] [Info  - 12:13:51 AM] (18208) Assuming Python version 3.10
2023-05-31 00:13:56.051 [info] [Info  - 12:13:56 AM] (18208) Found 38 source files
2023-05-31 00:13:56.121 [info] [Info  - 12:13:56 AM] (18208) Setting pythonPath for service "DS_Projects": "C:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:13:56.123 [info] [Warn  - 12:13:56 AM] (18208) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-31 00:13:56.232 [info] [Info  - 12:13:56 AM] (18208) Assuming Python version 3.10
2023-05-31 00:13:56.527 [info] [Info  - 12:13:56 AM] (18208) Found 1 source file
2023-05-31 00:13:56.543 [info] [Info  - 12:13:56 AM] (18208) Setting pythonPath for service "DS_Projects": "c:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:13:56.544 [info] [Warn  - 12:13:56 AM] (18208) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-31 00:13:56.682 [info] [Info  - 12:13:56 AM] (18208) Assuming Python version 3.10
2023-05-31 00:14:06.829 [info] [Info  - 12:14:06 AM] (18208) Found 38 source files
2023-05-31 00:14:06.852 [info] [Info  - 12:14:06 AM] (18208) Setting pythonPath for service "DS_Projects": "C:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:14:06.852 [info] [Warn  - 12:14:06 AM] (18208) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-31 00:14:07.007 [info] [Info  - 12:14:07 AM] (18208) Assuming Python version 3.10
2023-05-31 00:14:07.287 [info] [Info  - 12:14:07 AM] (18208) Found 1 source file
2023-05-31 00:14:07.305 [info] [Info  - 12:14:07 AM] (18208) Indexer background runner(4) root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist (index)
2023-05-31 00:14:07.305 [info] [Info  - 12:14:07 AM] (18208) Indexing(4) started
2023-05-31 00:14:07.306 [info] [Info  - 12:14:07 AM] (18208) scanned(4) 311 files over 1 exec env
2023-05-31 00:14:07.493 [info] [Info  - 12:14:07 AM] (18208) Setting pythonPath for service "DS_Projects": "c:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:14:07.494 [info] [Warn  - 12:14:07 AM] (18208) stubPath c:\Users\amroc\OneDrive\Documents\DS_Projects\typings is not a valid directory.
2023-05-31 00:14:07.632 [info] [Info  - 12:14:07 AM] (18208) Assuming Python version 3.10
2023-05-31 00:14:22.836 [info] [Info  - 12:14:22 AM] (18208) Found 38 source files
2023-05-31 00:14:22.853 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:X16sZmlsZQ==.py (2211ms)
2023-05-31 00:14:22.853 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:X15sZmlsZQ==.py (2212ms)
2023-05-31 00:14:22.853 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:X14sZmlsZQ==.py (2212ms)
2023-05-31 00:14:22.854 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:X13sZmlsZQ==.py (2212ms)
2023-05-31 00:14:22.855 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:X12sZmlsZQ==.py (2213ms)
2023-05-31 00:14:22.855 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:X11sZmlsZQ==.py (2214ms)
2023-05-31 00:14:22.855 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:X10sZmlsZQ==.py (2214ms)
2023-05-31 00:14:22.855 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W6sZmlsZQ==.py (2215ms)
2023-05-31 00:14:22.855 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W5sZmlsZQ==.py (2215ms)
2023-05-31 00:14:22.856 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W4sZmlsZQ==.py (2217ms)
2023-05-31 00:14:22.856 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W3sZmlsZQ==.py (2218ms)
2023-05-31 00:14:22.856 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W2sZmlsZQ==.py (2218ms)
2023-05-31 00:14:22.856 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W1sZmlsZQ==.py (2218ms)
2023-05-31 00:14:22.856 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W0sZmlsZQ==.py (2562ms)
2023-05-31 00:14:22.856 [info] [Info  - 12:14:22 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:pylancePrefixCell.py (2884ms)
2023-05-31 00:14:22.871 [info] [Info  - 12:14:22 AM] (18208) scanned(4) 311 files over 1 exec env
2023-05-31 00:14:23.565 [info] [Info  - 12:14:23 AM] (18208) scanned(4) 311 files over 1 exec env
2023-05-31 00:14:28.185 [info] [Info  - 12:14:28 AM] (18208) [IDX(4)] Long operation: index execution environment c:\Users\amroc\OneDrive\Documents\DS_Projects (4485ms)
2023-05-31 00:14:28.187 [info] [Info  - 12:14:28 AM] (18208) [IDX(4)] Long operation: index packages c:\Users\amroc\OneDrive\Documents\DS_Projects (4499ms)
2023-05-31 00:14:28.188 [info] [Info  - 12:14:28 AM] (18208) indexed(4) 223 files over 1 exec env
2023-05-31 00:14:28.243 [info] [Info  - 12:14:28 AM] (18208) Indexing finished(4).
2023-05-31 00:52:05.375 [info] [Info  - 12:52:05 AM] (18208) Setting pythonPath for service "DS_Projects": "C:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:52:05.499 [info] [Info  - 12:52:05 AM] (18208) Assuming Python version 3.10
2023-05-31 00:52:05.740 [info] [Info  - 12:52:05 AM] (18208) Found 1 source file
2023-05-31 00:52:05.751 [info] [Info  - 12:52:05 AM] (18208) Setting pythonPath for service "DS_Projects": "c:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:52:05.903 [info] [Info  - 12:52:05 AM] (18208) Assuming Python version 3.10
2023-05-31 00:52:25.145 [info] [Info  - 12:52:25 AM] (18208) Found 38 source files
2023-05-31 00:52:25.192 [info] [Info  - 12:52:25 AM] (18208) Setting pythonPath for service "DS_Projects": "C:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:52:25.330 [info] [Info  - 12:52:25 AM] (18208) Assuming Python version 3.10
2023-05-31 00:52:25.584 [info] [Info  - 12:52:25 AM] (18208) Found 1 source file
2023-05-31 00:52:25.600 [info] [Info  - 12:52:25 AM] (18208) Setting pythonPath for service "DS_Projects": "c:\Users\amroc\anaconda3\python.exe"
2023-05-31 00:52:25.729 [info] [Info  - 12:52:25 AM] (18208) Assuming Python version 3.10
2023-05-31 00:52:43.955 [info] [Info  - 12:52:43 AM] (18208) Found 38 source files
2023-05-31 00:52:43.975 [info] [Info  - 12:52:43 AM] (18208) [BG(2)] Long operation: getSemanticTokens delta previousResultId:1685518472442 at c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:X31sZmlsZQ==.py (2093ms)
2023-05-31 00:52:43.978 [info] [Info  - 12:52:43 AM] (18208) Indexer background runner(5) root directory: c:\Users\amroc\.vscode\extensions\ms-python.vscode-pylance-2023.5.40\dist (index)
2023-05-31 00:52:43.979 [info] [Info  - 12:52:43 AM] (18208) Indexing(5) started
2023-05-31 00:52:43.980 [info] [Info  - 12:52:43 AM] (18208) scanned(5) 311 files over 1 exec env
2023-05-31 00:52:44.527 [info] [Info  - 12:52:44 AM] (18208) scanned(5) 311 files over 1 exec env
2023-05-31 00:52:46.353 [info] [Info  - 12:52:46 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:W0sZmlsZQ==.py (2030ms)
2023-05-31 00:52:46.354 [info] [Info  - 12:52:46 AM] (18208) [BG(2)] Long operation: analyzing: c:\Users\amroc\OneDrive\Documents\DS_Projects\Trading_Bot\alpaca_stock_best_model.ipynb:pylance-notebook-cell:pylancePrefixCell.py (2090ms)
2023-05-31 00:52:48.874 [info] [Info  - 12:52:48 AM] (18208) [IDX(5)] Long operation: index execution environment c:\Users\amroc\OneDrive\Documents\DS_Projects (4221ms)
2023-05-31 00:52:48.877 [info] [Info  - 12:52:48 AM] (18208) [IDX(5)] Long operation: index packages c:\Users\amroc\OneDrive\Documents\DS_Projects (4237ms)
2023-05-31 00:52:48.877 [info] [Info  - 12:52:48 AM] (18208) indexed(5) 223 files over 1 exec env
2023-05-31 00:52:48.947 [info] [Info  - 12:52:48 AM] (18208) Indexing finished(5).
AYUSHSURYAVANSHI commented 1 year ago

4434

StellaHuang95 commented 1 year ago

Hi @amroca79, the error you encountered indicates that there is an issue accessing the named_steps attribute for a member of type BaseEstimator. The named_steps attribute is specific to sklearn's Pipeline class, to resolve the issue, please make sure you are using the named_steps attribute on a valid Pipeline object. Please reopen the issue if you have any further questions, thanks!

amroca79 commented 1 year ago

This does not fix the problem. When I enter pipeline.named_steps I retrieve all the scallers and models in the pipeline object without any calculations performed. If my logic is correct, I'm trying to figure it out which is the best scaller and hyperparameters to be used for an specific type of data. Below is my logic, feel free to correct me if I'm wrong:

and finally using, input: grid_s.best_estimator_.named_steps['scaler'] output: MaxAbsScaler() I believe It executes the right code, but I still get a warning.

erictraut commented 1 year ago

If you would like additional assistance, please post a self-contained, minimal code sample that demonstrates your problem. The sample you provided at the top of this issue has a number of syntax errors, and it references symbols that are not supplied in the code sample. For example, GridSearchCV is not defined anywhere, so it's unclear where this symbol comes from or how it is defined.

amroca79 commented 1 year ago

I just updated the code above. I hope is correct. Your help is much appreciated

amroca79 commented 1 year ago

I guess I found a solution for my own problem with chatGPT. If anyone needs help...

Go to Users setting.json and add:

   "python.analysis.diagnosticSeverityOverrides": {
        "reportGeneralTypeIssues": "none",
    },

Thanks for nothing

debonte commented 1 year ago

We think we can fix this by making GridSearchCV generic in our sklearn stubs.

Disabling reportGeneralTypeIssues is a big hammer. It's going to disable a lot of diagnostics unrelated to this particular issue.

debonte commented 1 year ago

In the meantime you can suppress the diagnostic on a particular line using the techniques described here.

amroca79 commented 1 year ago

thank you for the clarification. Very helpful

heejaechang commented 1 year ago

This issue has been fixed in prerelease version 2023.6.11, which we've just released. You can find the changelog here: CHANGELOG.md

amroca79 commented 1 year ago

I updated pylance to version v2023.6.10 but I still have the same issue

Screenshot 2023-06-13 210327

rchiodo commented 1 year ago

It was fixed in 2023.6.11, not 2023.6.10. The prerelease version. See Heejae's comment above.

It should end up in 2023.6.20 today.

amroca79 commented 1 year ago

thank you. It looks good now