Exemplo n.º 1
0
def dataset_config(request):
	has_preview = False
	name = request.session.get('typeDataset')

	if(request.method == 'POST'):
		form = _get_dataset_form(request.session.get('typeDataset'), request.POST, doc=request.FILES)
		# a = request.session.get('typeDataset')
		if(form.is_valid()):
			if(name == 'random'):
				request.session['dataset'] = random_generation(form.cleaned_data['nbPoints'],
															   form.cleaned_data['nbClass'],)
			elif(name == 'uniformGroup'):
				request.session['dataset'] = group_generation(form.cleaned_data['nbClass'],
															  form.cleaned_data['nbPointPerClass'],)
			elif(name == 'percentGroup'):
				request.session['dataset'], loss = percent_generation(form.cleaned_data['percents'],
																	  form.cleaned_data['nbPoints'],)
			elif(name == 'custom'):
				request.session['dataset'] = read_file(request.FILES['docfile'])
			# Generate the preview of the training set
			preview(request.session['dataset'])
			has_preview = True

			# Redirect if the user wants to go to the algorithm selection
			if('nextstep' in request.POST):
				return redirect('algo_select')
	else:
		form = _get_dataset_form(request.session.get('typeDataset'))

	return render(request, 'integration/dataset_configuration.html', {'form': form,
																	  'has_preview': has_preview,
																	  'typeDataset': request.session.get('typeDataset')})
Exemplo n.º 2
0
def execute_all(request):
	if(request.method == 'POST'):
		form = ExecuteAllForm(request.POST)
		if(form.is_valid()):
			new = form.cleaned_data['newPoint']
			dataset = request.session.get('dataset')
			knnRes = kmeans(new, dataset)
			pairBasedRes = PairBased(new, dataset)
			fadanaRes = fadana(new, dataset)

			preview(request.session['dataset'], new=new) # genère l'image a afficher (juste un plan du dataset)
			results = {'kmeans': knnRes[-1], 'fadana': fadanaRes[0], 'pair based': pairBasedRes[0], 'lazy analogical': "Not implemented yet"}

			return render(request, 'integration/algorithm_comparison.html', {'results': results})
	else:
		form = ExecuteAllForm()
	return render(request, 'integration/algorithm_selection.html', {'form': SelectAlgorithmForm(), 'formAll': form})