This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newmtl polkadots | |
Ns 10.0000 | |
Ni 1.5000 | |
d 1.0000 | |
Tr 0.0000 | |
Tf 1.0000 1.0000 1.0000 | |
illum 2 | |
Ka 0 0 0 | |
Kd 0 0 0 | |
Ks 0.0000 0.0000 0.0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def onlinePredictBy(self, newdata, k=5, wt='distance'): | |
"""Return online predicted values of a target array""" | |
self.newdata = newdata | |
# build an index array except the ones containing the target | |
self.dim = newdata.shape[1] | |
self.ind = np.arange(0, self.dim) | |
self.ind = np.setdiff1d(self.ind,self.target) | |
self.x = self.SOM.codebook.matrix[:,self.ind] | |
self.y = self.SOM.codebook.matrix[:,self.target] | |
self.n_neighbors = k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ie: allData.shape = (587, 165) | |
# old_codebook_matrix.shape = (2500, 165) | |
from sklearn.metrics import accuracy_score | |
#... | |
if the_codebook != None: | |
the_codebook = h5py.File(str(the_codebook),'r') | |
old_codebook_matrix = the_codebook['codebook/matrix'] | |
split_point = math.floor(allData.shape[0]/2) | |
train_set = allData[:split_point] # splitting allData for train/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SOM(object): | |
def __init__(self, | |
data, | |
neighborhood, | |
prev_codebook_matrix=None, # initialization with previous codebook matrix | |
normalizer=None, | |
mapsize=None, | |
mask=None, | |
mapshape='planar', | |
lattice='rect', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ex: data.spahe -> (603, 165) | |
# bmus shape - > (603,) | |
def plotOnSignal(self,s=10,cmap="viridis",data): | |
"""Plot Bmus on top of the rawData. Plotting in Context.""" | |
bmus = self.SOM.project_data(data) | |
rows = data.shape[0] | |
# | |
plt.title('BMUS on FEEDBACK DATA') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// directory | |
// | |
// public(folder) | |
// --app.js | |
// --js(folder) | |
// ----form.js | |
var contactForm = document.getElementById( 'contactForm' ); | |
new stepsForm( contactForm, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// directory | |
// | |
// public(folder) | |
// --app.js | |
// --js(folder) | |
// ----form.js | |
// app.js |