This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def leave_one_out(df_train, df_test, var, noise=.01, drop=True): | |
new_var = 'mean_{}'.format(var) | |
df_train[new_var] = np.nan | |
df_test[new_var] = np.nan | |
# training set | |
loo = LeaveOneOut() | |
for train_index, test_index in tqdm_notebook(loo.split(df_train)): | |
loo_train = df_train.iloc[train_index] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_target_mean(df_train, df_test, var, target, NFOLDS, NOISE): | |
""" | |
Creates out of fold averages by the categorical variable passed. | |
Decreasing the number of folds and increasing the noise can help | |
prevent over fitting the training set. | |
""" | |
df_train['mean_{}'.format(var)] = np.nan | |
df_test['mean_{}'.format(var)] = np.nan | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static bool CheckBad(int[] a) | |
{ | |
for (int i = 0; i < a.Length; i++) | |
if (a[i] != i) | |
return false; | |
return true; | |
} | |
if (N >= 2) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Tic_Tac_Toe_Checker | |
{ | |
class Program | |
{ | |
static void Main(string[] args) //testing method |