Machine Learning is study of various Algorithmic Model to analyze the datasets for a particular problem.
Machine Learning requires vectorized datasets for the application of various Algoritmic models.Suppose,you are given a problem statement of variable length input sequence,in that case your datasets should be changed into equal length Sequence.
To convert the datsets into equal length sequence,concept of padding can be used. Padding can be used, whereby you would have to fix the length of each sample (either to the length of the longest sample, or to a fixed length — longer samples would be trimmed or filtered somehow to fit into that length).Machine Learning have various methods of padding:
import pandas as pd
with open(r’C:\Users\1729398\Downloads\test.csv’) as ifile:
read = csv.reader(ifile)
for row in read:
with open(r’C:\Users\1729398\Downloads\b1.csv’,”a”) as csvFile:
writer = csv.writer(csvFile)
csvFile.close()from keras.preprocessing.sequence import pad_sequencessequences = [
]padded = pad_sequences(sequences, padding=’post’)
This is an educational post and it is inspired from Prof.Jason Brownlee’s Tutorials.