Skip to content

Commit

Permalink
interpreters and ploters
Browse files Browse the repository at this point in the history
  • Loading branch information
arkasarius committed Sep 3, 2019
1 parent c7a6831 commit 99bd88a
Show file tree
Hide file tree
Showing 60 changed files with 197 additions and 30 deletions.
Binary file modified TFG_Ordoñez_Roger.docx
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 0 additions & 30 deletions intepreter.py

This file was deleted.

54 changes: 54 additions & 0 deletions intepreter_AM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import calculos as c
import os

import matplotlib.pyplot as plt
import numpy as np

movie="Men in black"
m="moviesdata"
g="actordata"
s='/'
apidata=os.listdir(m+s+movie)
actordata=os.listdir(g+s+movie)
print(movie)
print(apidata)
print(actordata)
DM=2 # 0.0 distancia minima posible
AM=1 # 1.0 angle maxim posible

x=[]
y=[]
while AM>=0:

AM=AM-0.01
# DM=1.2
x.append(AM)

for unkownactor in apidata:
act=c.extraerSublistaArchivo(m+s+movie+s+unkownactor)
# print("\n")
# print('{} subcaras para el actor {}'.format(len(act),unkownactor.strip('.txt')))
for subactor in actordata:
currentactor=c.extraerSublistaArchivo(g+s+movie+s+subactor)
count=0
for subcara in act:
for caratest in currentactor:
if(c.similitudCoseno(caratest,subcara)>AM):
if(c.distanciaEuclidea(caratest,subcara)<DM):
count=count+1
if(count>0):
print('{} true per {}, {} vegades amb AM: {}'.format(subactor.strip('.txt'),unkownactor.strip('.txt'),count,AM))
y.append(count)
else:
y.append(0)
# pass
# print("no hi han cares valides per els coeficients AM : {} i DM: {} per l'actor {}".format(AM,DM,subactor.strip('.txt')))
# DM=50
# plt.style.use('bmh')

plt.plot(x,y)
plt.title(actordata[0].strip(".txt"))
plt.xlabel("Coeficiente AM")
plt.ylabel("Verdaderos positivos")
plt.grid()
plt.show()
54 changes: 54 additions & 0 deletions intepreter_DM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import calculos as c
import os

import matplotlib.pyplot as plt
import numpy as np

movie="Men in black"
m="moviesdata"
g="actordata"
s='/'
apidata=os.listdir(m+s+movie)
actordata=os.listdir(g+s+movie)
print(movie)
print(apidata)
print(actordata)
DM=0.0 # 0.0 distancia minima posible
AM=0 # 1.0 angle maxim posible

x=[]
y=[]
while DM<2:

DM=DM+0.01
# DM=1.2
x.append(DM)

for unkownactor in apidata:
act=c.extraerSublistaArchivo(m+s+movie+s+unkownactor)
# print("\n")
# print('{} subcaras para el actor {}'.format(len(act),unkownactor.strip('.txt')))
for subactor in actordata:
currentactor=c.extraerSublistaArchivo(g+s+movie+s+subactor)
count=0
for subcara in act:
for caratest in currentactor:
if(c.similitudCoseno(caratest,subcara)>AM):
if(c.distanciaEuclidea(caratest,subcara)<DM):
count=count+1
if(count>0):
print('{} true per {}, {} vegades amb DM: {}'.format(subactor.strip('.txt'),unkownactor.strip('.txt'),count,DM))
y.append(count)
else:
y.append(0)
# pass
# print("no hi han cares valides per els coeficients AM : {} i DM: {} per l'actor {}".format(AM,DM,subactor.strip('.txt')))
# DM=50
# plt.style.use('bmh')

plt.plot(x,y)
plt.title(actordata[0].strip(".txt"))
plt.xlabel("Coeficiente DM")
plt.ylabel("Verdaderos positivos")
plt.grid()
plt.show()
89 changes: 89 additions & 0 deletions intepreter_DM_AM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import calculos as c
import os

import matplotlib.pyplot as plt
import numpy as np

movie="Men in black"
m="moviesdata"
g="actordata"
s='/'
apidata=os.listdir(m+s+movie)
actordata=os.listdir(g+s+movie)
print(movie)
print(apidata)
print(actordata)
DM=0.0 # 0.0 distancia minima posible
AM=0 # 1.0 angle maxim posible

x=[]
y=[]
DM=0.0 # 0.0 distancia minima posible
AM=0 # 1.0 angle maxim posible
while DM<2:

DM=DM+0.01
# DM=1.2
x.append(DM)

for unkownactor in apidata:
act=c.extraerSublistaArchivo(m+s+movie+s+unkownactor)
# print("\n")
# print('{} subcaras para el actor {}'.format(len(act),unkownactor.strip('.txt')))
for subactor in actordata:
currentactor=c.extraerSublistaArchivo(g+s+movie+s+subactor)
count=0
for subcara in act:
for caratest in currentactor:
if(c.similitudCoseno(caratest,subcara)>AM):
if(c.distanciaEuclidea(caratest,subcara)<DM):
count=count+1
if(count>0):
print('{} true per {}, {} vegades amb DM: {}'.format(subactor.strip('.txt'),unkownactor.strip('.txt'),count,DM))
y.append(count)
else:
y.append(0)
# pass
# print("no hi han cares valides per els coeficients AM : {} i DM: {} per l'actor {}".format(AM,DM,subactor.strip('.txt')))
# DM=50
# plt.style.use('bmh')
n=[]
z=[]
DM=2 # 0.0 distancia minima posible
AM=1 # 1.0 angle maxim posible
while AM>=0:

AM=AM-0.01
# DM=1.2
n.append(AM)

for unkownactor in apidata:
act=c.extraerSublistaArchivo(m+s+movie+s+unkownactor)
# print("\n")
# print('{} subcaras para el actor {}'.format(len(act),unkownactor.strip('.txt')))
for subactor in actordata:
currentactor=c.extraerSublistaArchivo(g+s+movie+s+subactor)
count=0
for subcara in act:
for caratest in currentactor:
if(c.similitudCoseno(caratest,subcara)>AM):
if(c.distanciaEuclidea(caratest,subcara)<DM):
count=count+1
if(count>0):
print('{} true per {}, {} vegades amb AM: {}'.format(subactor.strip('.txt'),unkownactor.strip('.txt'),count,AM))
z.append(count)
else:
z.append(0)
# pass
# print("no hi han cares valides per els coeficients AM : {} i DM: {} per l'actor {}".format(AM,DM,subactor.strip('.txt')))
# DM=50
# plt.style.use('bmh')

plt.plot(x,y,label="DM")
plt.plot(n,z,label="AM")
plt.title(actordata[0].strip(".txt"))
plt.xlabel("Coeficiente DM AM")
plt.ylabel("Verdaderos positivos")
plt.grid()
plt.legend()
plt.show()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 99bd88a

Please sign in to comment.