'cannot find regression in sklearn.metrics

I'm trying to use the following:

from fireTS.models import NARX, DirectAutoRegressor
from sklearn.ensemble import RandomForestRegressor
from xgboost import XGBRegressor
import numpy as np
import scipy
import sklearn
import pandas as pd
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt

However, upon running the first line, an error saying:

ModuleNotFoundError: No module named 'sklearn.metrics.regression'

Interestingly, I cannot find anything on the web about this problem (even in the recently asked question in stackoverflow about this 26+ days ago).

Anyone who have encountered the same and was bale to fix this?

EDIT:

SO I FOUND THE FIX.

I went to the library where my firets is located and clicked models.py.

I changed the following:

from sklearn.metrics.regression import r2_score, mean_squared_error

to

from sklearn.metrics import r2_score, mean_squared_error

and hola, NO MORE ERRORS :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source