vumix/commit
tuning for experiments
author | Michiel Hildebrand |
---|---|
Tue May 29 19:12:12 2012 +0200 | |
committer | Michiel Hildebrand |
Tue May 29 19:12:12 2012 +0200 | |
commit | bfe8583c08e18de5d6516f59ab572b8a75a6531b |
tree | 9cb43a517df84c7f3d92381ec96f417b85d6fba3 |
parent | 5c7b50f8791ea0c6b5edc4d4251a2e2f1d1d2267 |
Diff style: patch stat
diff --git a/lib/ptr.pl b/lib/ptr.pl index e5cba8a..7fb6f72 100644 --- a/lib/ptr.pl +++ b/lib/ptr.pl @@ -6,7 +6,7 @@ :- use_module(library(stop_words)). :- use_module(library(real)). -:- use_module(library(tag_concept), [baseline_video/1,m_video/1]). +:- use_module(library(tag_concept), [baseline_video/1,m_video/1,topN/4,video_mbh_terms/2]). %:- use_module(video_vectors). /* Probabilistic tag relevance @@ -32,8 +32,9 @@ http://www2009.eprints.org/36/1/p351.pdf create_collection :- debug(ptr_collection), retractall(c_vector(_,_)), + retractall(median_cache(_)), % collect videos and tags in the collection - findall(V, baseline_video(V), Videos), + findall(V, m_video(V), Videos), collection_tags(Videos, Tags), % output some stats length(Videos, Video_Count), @@ -78,10 +79,10 @@ median_test :- print(x). c_median(M) :- - M = 12.64911, - %median_cache(M), + %M = 12.64911, + median_cache(M), !. -c_median(Vectors) :- +c_median(M) :- findall(V, c_vector(_, V), Vectors), pair_wise_distance(Vectors, Ds), d <- Ds, @@ -125,7 +126,7 @@ ptr_probs([Tag|Tags], Video, [Prob|Probs]) :- ptr_probs(Tags, Video, Probs). ptr(Video, Tag, Probability) :- - findall(V, tag_of_c_video(literal(Tag), V), Neighbour_Videos0), + findall(V, (tag_of_c_video(literal(Tag), V),V\==Video), Neighbour_Videos0), sort(Neighbour_Videos0, Neighbour_Videos), length(Neighbour_Videos, V_Count0), debug(ptr, 'videos: ~w', [V_Count0]), @@ -193,3 +194,26 @@ tag_of_c_video(Tag, Video) :- rdf(AnnotationId, pprime:score, literal(ScoreA)), atom_number(ScoreA, Score), Score > 5. + + + + +mbh_ptr_topN_eval_table :- + ( m_video(V), + rdf(V, dc:id, literal(Id)), + video_mbh_terms(V, Terms), + length(Terms, TermCount), + + ( TermCount is 0 + -> format('~w', [Id]) + ; TermCount2 is TermCount*2, + ptr_rank(V, Tags), + pairs_values(Tags, Tags1), + topN(Tags1, TermCount, Terms, TopN), + topN(Tags1, TermCount2, Terms, Top2N), + + format('~w,~2f,~2f~n', [Id, TopN, Top2N]) + ), + fail + ; true + ). diff --git a/lib/tag_concept.pl b/lib/tag_concept.pl index 8394eb3..f234417 100644 --- a/lib/tag_concept.pl +++ b/lib/tag_concept.pl @@ -4,7 +4,9 @@ video_concepts/3, derived_concepts/4, m_video/1, - baseline_video/1 + baseline_video/1, + video_mbh_terms/2, + topN/4 ]). @@ -538,7 +540,14 @@ cooccur(Tag1,Tag2,Score) :- m_video(V) :- baseline_video(V), %rdf(V, rdf:type, pprime:'Video'), - multiple_players(V). + multiple_players(V), + min_tags(V). + +min_tags(V) :- + findall(P,(rdf(V,pprime:hasAnnotation,A),rdf(A,rdf:value,P)), Ps0), + sort(Ps0, Ps), + length(Ps,N), + N > 200. multiple_players(V) :- findall(P,(rdf(V,pprime:hasAnnotation,A),rdf(A,pprime:creator,P)), Ps0), @@ -548,6 +557,8 @@ multiple_players(V) :- + + mbh_topN_eval_table :- ( m_video(V), rdf(V, dc:id, literal(Id)),