Using the weights of an RBM as feature vectors for PCA
In this section, we will be writing an enhanced version of RBM_01.py
. RBM_01.py
produces the feature vector of one viewer named X. The goal now is to extract the features of 12,000 viewers, for example, to have a sufficient number of feature vectors for PCA.
In RBM_01.py
, viewer X's favorite movies were first provided in a matrix. The goal now is to produce a random sample of 12,000 viewer vectors.
The first task at hand is to create an RBM launcher to run the RBM 12,000 times to simulate a random choice of viewers and their favorite movies, which are the ones the viewer liked. Then, the feature vector of each viewer will be stored.
RBM_launcher.py
first imports RBM as rp
:
import RBM as rp
The primary goal of RBM_launcher.py
is to carry out the basic functions to run RBM. Once RBM
is imported, the feature vector's .tsv
file is created:
#Create feature files
f=open("features.tsv"...