What is batch_size, which is often seen in machine learning?

Asked 1 years ago, Updated 1 years ago, 45 views

What is batch_size, which often appears in machine learning?

y_vals=np.transpose ([np.array([y[13]for y in housing_data]])
x_vals=np.array([x for i, x in enumerate(y)]
                if housing_header [i]incols_used] for in housing_data])

# Scale x values from 0 to 1 using min-max scaling
x_vals=(x_vals-x_vals.min(0))/x_vals.ptp(0)

np.random.seed(13)
train_indices=np.random.choice(len(x_vals), round(len(x_vals)*0.8), replace=False)
test_indices=np.array(list(set(range(len(x_vals)))-set(train_indices)))))
x_vals_train=x_vals [train_indices]
x_vals_test=x_vals [test_indices]
y_vals_train=y_vals [train_indices]
y_vals_test=y_vals [test_indices]

k = 4
batch_size=len(x_vals_test)

REFERENCE: TensoFlow Machine Learning Cookbook

tensorflow machine-learning

2022-09-30 20:18

3 Answers

The batches here refer to a batch of data to be processed.Batch size = data size.In computer terms, "batch" is more commonly used to refer to processing, and I don't think it's a very common usage to refer to processing.

Batch is a common term and is used outside of the computational field.In the "JCO criticality accident" (commonly known as the "Uranium with a Bucket" accident), we used to describe a bucket of raw materials and processing them as a batch.In the first place, if you look at the dictionary, it says, "A piece of bread, pottery, etc., for a kiln."


2022-09-30 20:18

Batch is a computational term.

There are two main methods of processing with a calculator:
a) Programming data all at once
b) The operator will input data and other data to proceed according to the output from the program.

Batch (batch processing) is a) method. b)is referred to as interactive or real-time processing.

The file extension for executing a series of commands on Windows et al. is ".bat", but comes from Batch.

==
The batch in the question code is presumed to mean doing the same thing for multiple data all at once.

batch_size=len(x_vals_test)

is probably looking for the number of data to process in order to use the test data to determine the learning results.
The test data (x_vals_test and y_vals_test) are prepared with a slightly higher code.


2022-09-30 20:18

Machine learning introduces the idea of "batch" as a way to get learning done quickly and successfully.This is the idea of reducing computation by using some of the data instead of using all the data.

Then, some of the data (a batch of data) used to advance learning is abstractly called "batch", and the number of data used at this time is called "batch size".

batch_size=len(x_vals_test)

treats the size of the test data as a batch size (I don't know why).


2022-09-30 20:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.