Closed nyenggyang closed 1 year ago
smile.clustering.CentroidClustering<T,U>
The centroids
field or variable member of class smile.clustering.CentroidClustering<T,U>
is documented here as being a 1D array (of type T), as follows: public final T[] centroids
. However, this variable data member of this class is actually a 2D array (not a 1D array).
smile.data.formula.Formula
My invocation of the following factory method of class smile.data.formula.Formula
(shown in the point number 2A below) results in my getting the following exception report (shown in the point number 2B below, for Java code that is stored in a file named LinearRegression.java) when I ran the following lines of code in this file (shown in the point number 2C below):
(A) This is the method:
of(java.lang.String response, java.lang.String... predictors)
(B) This is the exception report:
Exception in thread "main" java.lang.UnsupportedOperationException: The data has no response variable.
at smile.data.formula.Formula.y(Formula.java:438)
at smile.regression.OLS.fit(OLS.java:122)
at smile.regression.OLS.fit(OLS.java:105)
at smile.regression.OLS.fit(OLS.java:85)
at LinearRegression.main(LinearRegression.java:72)
(C) These are the lines of code:
65 DataFrame dataFrame = DataFrame.of(trainSetArray, columnNames);
68 Formula formula = Formula.of("SalesPrice", columnNames);
72 LinearModel linearModel = OLS.fit(formula, dataFrame);
Note the following about the lines of code shown in the foregoing point number 2C above:
The identifier trainSetArray
is a 2D double
array that has each row holding all the independent variables values and the single dependent variable value for each observation in my dataset and has each column holding the values, of either one of the independent variables or the single dependent variable, for all observations in my dataset.
The identifier columnNames
is a 1D java.lang.String
array that holds the names of all the columns in my dataset (the following is a printout of the contents of this identifier: [MSSubClass, LotFrontage, LotArea, OverallQual, OverallCond, YearBuilt, YearRemodAdd, BsmtFinSF1, BsmtUnfSF, TotalBsmtSF, 1stFlrSF, GrLivArea, FullBath, BedroomAbvGr, TotRmsAbvGrd, GarageYrBlt, GarageCars, GarageArea, OpenPorchSF, YrSold, SalePrices]
)
The java.lang.String
constant/literal "SalesPrice"
is my specified response variable in my dataset
Since I have provided a response variable in the second of the three lines of code above, I guess that there might be a bug in either the code of the of(java.lang.String response, java.lang.String... predictors)
method of class smile.data.formula.Formula
or some other code that the code of this method relies upon (in any case, after I checked the code implemented for this method in this class, I didn't see any reason why I should get the exception report shown in the foregoing point number 2B above).
I will be much obliged if someone can assist with an explanation for why I obtained the exception report shown in the foregoing point number 2B above.
Thanks in advance.
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like A clear and concise description of what you want to happen.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.