#🔒 Searching for suggestion in regards to prediction

79 messages · Page 1 of 1 (latest)

oak river
#

I required help in regard to the next step. Currently, the project is to figure out the best result from the three models, which were linear, logarithmic linear regression, and KNN. After the preprocessing step (Deleting null, empty, and etc) I decided to test it with the library I created. Currently, I do not have time to clean the code.

For the current context, the independent features are everything except "Pengeluaran Riil Per Kapita"

https://hastebin.com/share/didagupami.python

For these couple of weeks, I ignored MAE, MSE, and only focused on the r2. In the nutshell, with the original data, (no feature selection), the result goes as follows:

linear reg: 0.0019379825785782456
log lin reg: -0.138491503196299
KNN: 0.07097272631083451 (k=60)

After that, I decided to do this:
This part of the script deletes any independent feature that has correlation below or equal i with another independent feature, whislt j independent feature with dependent feature
https://hastebin.com/share/roveparote.python

I decided to turn the features to log and deleting it, the best result goes as follow
linear reg r2: 0.00193798257857825 (at i = 1 && -0.08)
log lin reg r2: -0.137177331469033 (at i = 1&&j=-0.07)
knn r2: 0.0709727263108345 (at i=1 && j=-0.07)
Which, you can see. r2 decreased

At this point, I thought the current variable is incorrect because I deleted based on log, whilst some feature aren't skewed and some are. Hence, I decided that the best method is to correlate matrix on the original data (the untitled one) and babysit it instead of deleting correlation based on the value i and j. Hence, this script:.

https://hastebin.com/share/jigimuleqi.python

The result goes as the table shown. The linear gets better, but knn resulted with lower rate, and decreased KNN. After this post, I heed my teacher's suggestion and will add SVM. But, as time goes on, I don't know, and deemed the result would still low. Hence, I requested your recommendation for the next step.

random wadiBOT
#

@oak river

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

oak river
#

Anyway, thanks for reading the long post. If you see anything weird, please inform me

rancid quiver
# oak river I required help in regard to the next step. Currently, the project is to figure ...

the first step in any ml modeling task is exploring & analyzing the data, what are you predicting, what are your features, how they're distributed, any outliers, how they may relate to each other, apply domain knowledge, ...
is there a good reason you're choosing to log transform your data?
your R2 scores suggest that none of the models are good at anything (R2 close to 0 means it's not better than just guessing the mean, negative means worse than guessing the mean)
having a lot of collinearity probably also makes your linear models a bit more unstable so you should probably deal with that

oak river
#

this is target y after I log transform it

#

as you can see, it is not skewed, before this, it was skewed

#

I ddin't save the original value in boxplot

#

hmm

rancid quiver
# oak river

what is your target? and why is the y axis "value" and x axis "features"

oak river
#

It seems that I can't give more images

oak river
rancid quiver
oak river
#

huh, i mislable, it seems.

#

yes

rancid quiver
#

imo you're just doing too little exploratory data analysis

oak river
#

I want to show you some independent features has the skewed behaviour, btw

rancid quiver
#

(and I can't really understand what your features are and what you're predicting)

oak river
#

cuz languange barrier?

rancid quiver
#

ye

oak river
#

ah, damn,

oak river
#

in my opinion, this is because of lack of knowledge. I don't know what to do

#

I can analyze as far as I can understand how to do analysis

#

hence, the corr matrix, feature selection

rancid quiver
oak river
#

maybe the cause of the problem is the choice of the features

rancid quiver
#

I mean you haven't even told me what they are

oak river
#

Oh, yeah, it's in my native langaunge

rancid quiver
oak river
#

If I say I will do it later, you won't be offended, right? because I think the application is the best thing to do now

#

because, I need to upload this in next week's wed

rancid quiver
#

other than that, I probably wouldn't choose those models you're using
ridge / lasso would probably do better than naive linear reg
and tree models are known to do well on tabular data

#

but like close to 0 and even negative R2 tells me something's really wrong with your modelling process

#

or that the data is just really hard to predict

oak river
#

Hmm, I will just tell you the features first

#
  1. province (ordinal), |
  2. city (ordinal),
  3. regency (ordinal).
  4. code of village administration (float).
  5. Topografi of the village.
  6. Near The sea (Bool).
  7. Number of houses in the village (float).
  8. Population (float).
  9. Pop. age 0-4 years.
    10 pop. age 5-9.
  10. Population 10-14.
  11. pop. 15-59.
  12. Pop age above 59.
  13. Number of head of the families
  14. Expenditure per capita per year
  15. Number of Jobless people
  16. Number of poor villagers
#

the dataset is originally confusing.

#

I am sorry, but I will vent for this one

#

The original data has 30 000 data points

#

but, in the end of cleaning the data, it is 8000

#

I deleted many types of rows, some has string, some has words to describe things

#

for example "12x7 000 000=84000000"

#

my method is to delete any expenditure, number of jobless people, number of poor villagers by deleting any char in the row, and leaving expenditure

#

hence, 12700000084000000

#

There are also percentage

rancid quiver
# oak river hence, 12700000084000000

I mean that just seems wrong?
if it says 12x7 000 000=84000000 then doesn't that mean the expenditure is 84000000 which is calculated from 12 * 7000000

oak river
#

yeah, it's 84 000 000

#

wait, let me check the real number

#

ah, this is the real number
500000 x 12 Bulan = 7000000

#

wait

#

I hate my life

#

Oh thank god

#

Im not the idiot, turns out

#

Anyway,

#

yeah, someone put unexpected string in the numbers( expenditure per capita)

#

hence, 500000127000000

rancid quiver
#

sounds like you should redo data cleaning

oak river
#

dude

#

Im not the one that has the original data

#

I am just here attempting to process the data provided by a team mate

rancid quiver
oak river
#

sigh

#

the ship has sailed with a broken bottom

#

I will sink, and I just realized it at 9/14 week in the curriculum

#

I knew that

#

I am sorry, I will sail, and hope I dont drown

#

Anyway, I will use the ridge and lasso next if SVM doesn't work

rancid quiver
#

choosing the model is like 10% of the effort, the other 90% goes to eda, data cleaning, feature processing
like once you have the processed data switching the model is easy

#

so I wouldn't really worry about the model at all

oak river
#

yet, I deemed the dataset to be defective

#

hence, I am hoping for the choice of the model to increases the result of r2 first

#

thank you for your help

#

I attempted my best, right?

#

I know it's an rhetorical question, and also, unrelated

random wadiBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.