Beispiel #1
0
print(
    "Tell me ho many components you would like to keep during the topk running (!! warning : this number can't exceed the total number of descriptors of each example) !!"
)
nbCompo = input()

# Number of examples we want in our testing set.
nbTestingData = 30

print("Building of the training set...")

# Define the training set.
trainingSet = data[:nbExamples]

print("Training data pre-processing...")

trainingSet = std.dataPreprocessing(trainingSet, hypPlace)

print("Building of the testing set...")

# Define the testing set.
testingSet = data[nbExamples:nbExamples + nbTestingData]

print("Testing data pre-processing")

testingSet = std.dataPreprocessing(testingSet, hypPlace)

# The depreciation of the SVM norm cost
l = 0.01

# The step of the descent
step = 1
print("######### Test of the conversion data -> str. ##########")
print('')

print("label of data1 = " + str(data[0].get(-1, 0)))
print("label of data2 = " + str(data[1].get(-1, 0)))
print("label of data3 = " + str(data[2].get(-1, 0)))

print("data0 = " + str(data[0]))

spddatadict2str = std.datadict2Sstr(data)
print("data under string is : " + spddatadict2str)

print('')
print("######### Test of the conversion str -> data. ##########")
print('')

spdstr2datadict = std.str2datadict(spddatadict2str)
print("data under list of dictionaries is : " + str(spdstr2datadict))

print('')
print("########### Test of the data preprocessing ############")
print('')

# Output values for moy and sigma have been checked by hand

data = [spV1, spV2, spV3]

treatedData = std.dataPreprocessing(data, 12)

print("treated data = " + str(treatedData))