<commit_before>#!/usr/bin/env python
# -*- coding: UTF-8 -*-

"""
This is a common rbm tools solved by CD-1.

"""

import time
import threading
from copy import deepcopy
from numpy import random, dot, sum, array, exp, zeros, float32 as REAL, concatenate
from scipy.special import expit
try:
    from queue import Queue
except ImportError:
    from Queue import Queue

def one_batch(model, data, \
	initialmomentum, finalmomentum, \
	weight_rate, vbias_rate, hbias_rate, weightcost,\
	epoch, batch_num, max_epochs, lock, isLinear):
	with lock:
		weights = deepcopy(model.weights)
		hidden_bias = deepcopy(model.hidden_bias)
		visible_bias = deepcopy(model.visible_bias)

	pos_hidden_activations = dot(data, weights) + hidden_bias<commit_msg>add todo for multi-thread version<commit_after>#!/usr/bin/env python
# -*- coding: UTF-8 -*-

"""
This is a common rbm tools solved by CD-1.

"""

import time
import threading
from copy import deepcopy
from numpy import random, dot, sum, array, exp, zeros, float32 as REAL, concatenate
from scipy.special import expit
try:
    from queue import Queue
except ImportError:
    from Queue import Queue

# TODO: too many memory use for batch as contain a new data piece

def one_batch(model, data, \
	initialmomentum, finalmomentum, \
	weight_rate, vbias_rate, hbias_rate, weightcost,\
	epoch, batch_num, max_epochs, lock, isLinear):
	with lock:
		weights = deepcopy(model.weights)
		hidden_bias = deepcopy(model.hidden_bias)
		visible_bias = deepcopy(model.visible_bias)

	pos_hidden_activations = dot(data, weights) + hidden_bias
{'fraction_non_alphanumeric': 0.09253350350989151, 'fraction_numerical': 0.005105296745373325, 'mean_word_length': 4.701818181818182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '3504557', 'n_tokens_mistral': 524, 'n_tokens_neox': 503, 'n_words': 166}