May 2018
Beginner
490 pages
13h 16m
English
The Python naive_bayes_blockchains.py program uses a skearn class. Consider the following snippet:
import numpy as npimport pandas as pdfrom sklearn.naive_bayes import GaussianNB
It reads the dataset into the data structure. The following code reads data_BC.csv into df:
#Reading the datadf = pd.read_csv('data_BC.csv')print("Blocks of the Blockchain")print (df.head())
It prints the top of the file in the following output:
Blocks of the Blockchain DAY STOCK BLOCKS DEMAND0 10 1455 78 11 11 1666 67 12 12 1254 57 13 14 1563 45 14 15 1674 89 1
It prepares the training set, using X to find and predict Y in the following code:
# Prepare the training setX = df.loc[:,'DAY':'BLOCKS']Y = df.loc[:,'DEMAND']
It chooses the class and ...
Read now
Unlock full access