Skip to content
Snippets Groups Projects
Commit 3f33ad04 authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

Added DB file

parent be844089
Branches
Tags
No related merge requests found
import numpy as np
def getOneViewFromDB(viewName, pathToDB):
view = np.genfromtxt(pathToDB + viewName, delimiter=';')
return view
def getClassLabels(pathToDB):
labels = np.genfromtxt(pathToDB + "ClassLabels.csv", delimiter=';')
return labels
def getDataset(pathToDB, viewNames):
dataset = []
for viewName in viewNames:
dataset.append(getOneViewFromDB(viewName, pathtoDB))
return np.array(dataset)
......@@ -3,6 +3,8 @@ import math
from joblib import Parallel, delayed
import Classifers
# Data shape : ((Views, Examples, Corrdinates))
def initialize(NB_CLASS, NB_VIEW, NB_ITER, DATASET_LENGTH, CLASS_LABELS):
costMatrices = np.array([
......@@ -45,7 +47,7 @@ def computeWeights(costMatrices, NB_CLASS, DATASET_LENGTH, iterIndice,
return weights
def trainWeakClassifier(classifierName, DATASET, CLASS_LABELS, costMatrices,
def trainWeakClassifier(classifierName, monoviewDataset, CLASS_LABELS, costMatrices,
NB_CLASS, DATASET_LENGTH, iterIndice, viewIndice,
classifier_config):
weights = computeWeights(costMatrices, NB_CLASS, DATASET_LENGTH,
......@@ -64,7 +66,7 @@ def trainWeakClassifers(classifierName, DATASET, CLASS_LABELS, costMatrices,
NB_JOBS = NB_CORES
trainedClassifiers, classesMatrix = Parallel(n_jobs=NB_JOBS)(
delayed(trainWeakClassifier)(classifierName, DATASET, CLASS_LABELS,
delayed(trainWeakClassifier)(classifierName, DATASET[viewIndice], CLASS_LABELS,
costMatrices, NB_CLASS, DATASET_LENGTH,
iterIndice, viewIndice, classifier_config)
for viewIndice in range(NB_VIEW))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment