import logging import sys import numpy import random from apgl.egograph.SvmInfoExperiment import SvmInfoExperiment logging.basicConfig(stream=sys.stdout, level=logging.INFO) numpy.random.seed(21) random.seed(21) SvmInfoExperiment.saveSvmParams(SvmInfoExperiment.getSvmParamsFileName())
infoProb = 0.1 """ p = 0.1 k = 15 generator = SmallWorldGenerator(p, k) """ #A second set of parameters p = float(30)/numVertices generator = ErdosRenyiGenerator(p) simulationRepetitions = 5 maxIterations = 3 sampleSize = SvmInfoExperiment.getNumSimulationExamples() #sampleSize = 1000 svmParamsFile = SvmInfoExperiment.getSvmParamsFileName() CVal, kernel, kernelParamVal, errorCost = SvmInfoExperiment.loadSvmParams(svmParamsFile) simulator = SvmEgoSimulator(examplesFileName) simulator.trainClassifier(CVal, kernel, kernelParamVal, errorCost, sampleSize) egoCsvReader = EgoCsvReader() genderIndex = egoCsvReader.genderIndex ageIndex = egoCsvReader.ageIndex incomeIndex = egoCsvReader.incomeIndex townSizeIndex = egoCsvReader.townSizeIndex foodRiskIndex = egoCsvReader.foodRiskIndex experienceIndex = egoCsvReader.experienceIndex internetFreqIndex = egoCsvReader.internetFreqIndex peopleAtWorkIndex = egoCsvReader.peopleAtWorkIndex