Questions tagged [leave-one-out]

21 questions
3
votes
2 answers

How to calculate mean absolute error for Bayesian modeling based on Leave-One-Out Cross-Validation with Brms package in R

I am fitting a Bayesian model to predict a test score using the Brms package. I would like to know how to calculate the 'Mean Absolute Error' based on 'Leave-One-Out Cross-Validation' (LOO) using the LOO package, but I could not find any information…
user8460166
  • 73
  • 1
  • 6
  • 24
1
vote
1 answer

F1 metric and LeaveOneOut validation strategy in scikit-learn

I want to use GridSearchCV to find the optimal n_neighbors parameter of KNeighborsClassifier I want to use 'f1_score' metrics AND 'leave one out' strategy. But this code clf = GridSearchCV(KNeighborsClassifier(), {'n_neighbors': [1, 2, 3]},…
1
vote
0 answers

Does the leave-one-out algorithm form a linear prediction?

I am using the leave-one-out algorithm using code that I found here. I'm copying the code below: from sklearn.model_selection import train_test_split from sklearn.model_selection import LeaveOneOut from sklearn.model_selection import…
1
vote
0 answers

Leave one out encoding with Dask dataframes

I have the following dask dataframe:- import dask.dataframe as dd import pandas as pd df = pd.DataFrame({"A": [1, 2, 1, 2, 3, 1, 2, 3, 5], "B": ["a", "b", "c", "c", "a", "b", "b", "a", "c"], "y":[0, 10, 2, 1, 4, 1, 6, 12, 11]}) X =…
Shawn Brar
  • 1,346
  • 3
  • 17
1
vote
3 answers

leave one out method for multiple csv files in python

I have a data set with multiple CSV files (12 files)... Each file belongs to a person. I've used a neural network for modeling each file and now I want to use the Leave-One-Out method and leave one file for the test... How could I do this in…
1
vote
1 answer

LeaveOneOut() - Key Error in an SVM Classifier

I am working with a csv file: 39 participants (rows) each having values for 30 features (columns). I am trying to implement LeaveOneOut() using the below code. I am getting a key error... Any help would be appreciated! # code X =…
K.level4
  • 11
  • 3
1
vote
1 answer

In Leave One Out Cross Validation, How can I Use `shap.Explainer()` Function to Explain a Machine Learning Model?

Background of the Problem I want to explain the outcome of machine learning (ML) models using SHapley Additive exPlanations (SHAP) which is implemented in the shap library of Python. As a parameter of the function shap.Explainer(), I need to pass an…
Md. Sabbir Ahmed
  • 850
  • 8
  • 22
1
vote
1 answer

R: GLM function error with simulated data

I have two vectors of simulated data as follows: x = rnorm(1000, mean = 0, sd = 1) eps = rnorm(1000, mean = 0, sd = sqrt(0.25)) I am trying to use boot library's glm and cv.glm function to fit a linear regression model and multiple linear…
0
votes
1 answer

Is this a proper cross-validation code with the Leave-One-Group-Out method?

Though the below code “works” (in that it does not give an error), I get very high AUCs which makes me wonder if it somehow skips over the actual type of cross-validation I am trying to make it conduct. Each group indicates the collection of data…
0
votes
0 answers

how to use k-fold target encoding to encode categorical column in on one observation to pass it to the model?

I'm working on a credit card fraud detection problem, while constructing the model, I encoded the categorical columns using K-Folded Target Encoding, the code of the encoding will be down bellow, after training testing (the testing dataset was…
0
votes
0 answers

How can I implement a Leave One Patient Out Cross Validation in Python?

I have a dataset of roughly 1600 samples. The whole dataset if made from 22 patients in total. Some patients contribute 250 samples, other patients just 10. This is a balanced dataset in total. I have around 800 samples for each class but the…
0
votes
1 answer

Why cross_val_score using LeaveOneOut() leads to nan validationscore?

I was trying to fit different cross_val_score type(k-fold(),LeaveOneOut(),LeavepOut()) in iris dataset of sklearn.But LeaveOneOut() leads to nan score list.why is this happening?Can anyone explain?Let me attach my part of code…
0
votes
0 answers

How to get value mapping from sklearn Leave One Out encoder?

I am using the LeaveOneOutEncoder from category_encoders. I am able to encode my data. How to get a map of the original value and looe_value pair? Original: city salary san jose 120 san…
topcan5
  • 1,511
  • 8
  • 30
  • 54
0
votes
1 answer

Calculating LOOCV with adjusted R-square scoring parameter

I have dataset where I transformed categorical dataset into numerical by dummies and I ran simple linear regression model to predict dependent variable. I got adjusted R-square as 0.66. Now I want to cross validate my model with leave one out method…
0
votes
0 answers

How to use learning curves and cross-validation?

My aim is to prove whether there is overfitting or underfitting. However, when I calculate the learning curves (graphically depict how a process is improved), the standard deviation of the cross-validation score is enormous. My observation here is…
vdu16
  • 123
  • 10
1
2