Skip to content

Instantly share code, notes, and snippets.

View yutthi's full-sized avatar
🏠
Working from home

yutthi

🏠
Working from home
View GitHub Profile
@Treeki
Treeki / TurnipPrices.cpp
Last active July 8, 2024 02:08
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@duttashi
duttashi / kfold-cv-custom-function.R
Created July 11, 2017 09:56
A simple function to perform k-fold cross validation in R
#Randomly shuffle the data
yourdata<-yourdata[sample(nrow(yourdata)),]
#Create 10 equally size folds
folds <- cut(seq(1,nrow(yourdata)),breaks=10,labels=FALSE)
#Perform 10 fold cross validation
for(i in 1:10){
#Segement your data by fold using the which() function
testIndexes <- which(folds==i,arr.ind=TRUE)
testData <- yourdata[testIndexes, ]
trainData <- yourdata[-testIndexes, ]