<commit_before>import csv
import os
import numpy as np
import logging

DATA_DIR = "training_data"
MAX_FILES = 10000000000

USE_ONE_FILE = True
SINGLE_FILENAME = ""

# return [X_hand[0:4], flop[0:13], flop[13:26], \
#         flop[26:39], flop[39:42], X_hand[4:11]]

class PlayerStats:
    def __init__(self):
        self._num_hands = 0
        self._no_pressure_count = 0
        self._no_pressure_call = 0
        self._pressure_fold = 0
        self._pressure_call = 0
        self._pressure_count = 0

    def process2(self, X, y):
        self._num_hands += 1
        num_players_left = X[0,0:4].index(1)
        under_pressure = True
        skip_next_input = False
        for i_vec, o_vec in zip(X, y):
            # Might need to skip first vector
            
            if not skip_next_input:
                action = X[0,11:14].index(1)
                # Fold
                if action == 0:
                    num_players_left -= 1
                elif action == 1:
                    pass
            else:
                skip_next_input = False
            
            # Player's turn
            if np.max(o_vec) == 1:
                skip_next_input = True

def save_csv():
    with open("probs.csv", "wb") as csvfile:
        writer = csv.writer(csvfile, delimiter=',',
                            quotechar='"', quoting=csv.QUOTE_MINIMAL)
        for _, v in player_to_stats.iteritems():
            writer.writerow(list(v))<commit_msg>Renamed player_statistics as player_stats.<commit_after>import csv
import os
import numpy as np
import logging

DATA_DIR = "training_data"
MAX_FILES = 10000000000

USE_ONE_FILE = True
SINGLE_FILENAME = ""

# return [X_hand[0:4], flop[0:13], flop[13:26], \
#         flop[26:39], flop[39:42], X_hand[4:11]]

class PlayerStats:
    def __init__(self):
        self._num_hands = 0
        self._no_pressure_count = 0
        self._no_pressure_call = 0
        self._pressure_fold = 0
        self._pressure_call = 0
        self._pressure_count = 0

    def process2(self, X, y):
        self._num_hands += 1
        num_players_left = X[0,0:4].index(1)
        under_pressure = True
        skip_next_input = False
        for i_vec, o_vec in zip(X, y):
            # Might need to skip first vector
            
            if not skip_next_input:
                action = X[0,11:14].index(1)
                # Fold
                if action == 0:
                    num_players_left -= 1
                elif action == 1:
                    pass
            else:
                skip_next_input = False
            
            # Player's turn
            if np.max(o_vec) == 1:
                skip_next_input = True

def save_csv2(player_to_stats):
    with open("probs.csv", "wb") as csvfile:
        writer = csv.writer(csvfile, delimiter=',',
                            quotechar='"', quoting=csv.QUOTE_MINIMAL)
        for _, v in player_to_stats.iteritems():
            writer.writerow([_[:-4]] + list(v))

def save_csv():
    with open("probs.csv", "wb") as csvfile:
        writer = csv.writer(csvfile, delimiter=',',
                            quotechar='"', quoting=csv.QUOTE_MINIMAL)
        for _, v in player_to_stats.iteritems():
            writer.writerow([_] + list(v))
{'fraction_non_alphanumeric': 0.1057160417947142, 'fraction_numerical': 0.03318992009834051, 'mean_word_length': 1.7514792899408285, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2325104', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1017, 'n_words': 233}