Skip to content

Instantly share code, notes, and snippets.

@bshambaugh
Created July 17, 2018 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bshambaugh/6748bb233f249ece013a73c462d85648 to your computer and use it in GitHub Desktop.
Save bshambaugh/6748bb233f249ece013a73c462d85648 to your computer and use it in GitHub Desktop.
this is the test of brents ext rescal
python extrescal.py --latent 2 --lmbda 0.001 --input tiny-mixed-example --outputentities entity.embeddings.csv --outputterms term.embeddings.csv --outputfactors latent.factors.csv --log extrescal.log
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFields Health and Medicine
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity 0.0 (time to maturity pulled from children pages)
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost 0.0(investment cost pulled from children pages)
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://purl.org/dc/terms/title Food Growing Methods
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://www.w3.org/2000/01/rdf-schema#comment For independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#commercialStatus Research
here is the attributes dictionary
defaultdict(<type 'list'>, {0: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFieldsHealth and Medicine'], 1: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity0.0 (time to maturity pulled from children pages)'], 2: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost0.0(investment cost pulled from children pages)'], 3: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://purl.org/dc/terms/titleFood Growing Methods'], 4: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u"http://www.w3.org/2000/01/rdf-schema#commentFor independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input."], 5: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://data.thespaceplan.com/ontologies/lsi#commercialStatusResearch']})
=================================
here is the predicate object string list
[u'http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFieldsHealth and Medicine', u'http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity0.0 (time to maturity pulled from children pages)', u'http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost0.0(investment cost pulled from children pages)', u'http://purl.org/dc/terms/titleFood Growing Methods', u"http://www.w3.org/2000/01/rdf-schema#commentFor independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.", u'http://data.thespaceplan.com/ontologies/lsi#commercialStatusResearch']
=================================
here is the unique predicate object string
{0: u'http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFieldsHealth and Medicine', 1: u'http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity0.0 (time to maturity pulled from children pages)', 2: u'http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost0.0(investment cost pulled from children pages)', 3: u'http://purl.org/dc/terms/titleFood Growing Methods', 4: u"http://www.w3.org/2000/01/rdf-schema#commentFor independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.", 5: u'http://data.thespaceplan.com/ontologies/lsi#commercialStatusResearch'}
here is the subjectlist
[rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl')]
==========================
here is the objectlist
[rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure'), rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support')]
==========================
here is the subject-object dictionary
{0: u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl', 1: u'http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure', 2: u'http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support'}
the key is 0 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFieldsHealth and Medicine
k2 ks: 0
the key is 1 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity0.0 (time to maturity pulled from children pages)
k2 ks: 1
the key is 2 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost0.0(investment cost pulled from children pages)
k2 ks: 2
the key is 3 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://purl.org/dc/terms/titleFood Growing Methods
k2 ks: 3
the key is 4 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://www.w3.org/2000/01/rdf-schema#commentFor independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.
k2 ks: 4
the key is 5 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://data.thespaceplan.com/ontologies/lsi#commercialStatusResearch
k2 ks: 5
defaultdict(<type 'list'>, {0: [0, 0, 0, 0, 0, 0]})
defaultdict(<type 'list'>, {0: [0, 1, 2, 3, 4, 5]})
[[1 1 1 1 1 1]
[0 0 0 0 0 0]
[0 0 0 0 0 0]]
The number of entities: 6
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity 0.0 (time to maturity pulled from children pages)
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost 0.0(investment cost pulled from children pages)
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://www.w3.org/2000/01/rdf-schema#comment For independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://purl.org/dc/terms/title Food Growing Methods
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#commercialStatus Research
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFields Health and Medicine
here is the predicate list
[rdflib.term.URIRef(u'http://data.thespaceplan.com/ontologies/lsi#label'), rdflib.term.URIRef(u'http://data.thespaceplan.com/ontologies/lsi#label')]
===========================
here is the subjectlist ==========
[rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl')]
==================================
here is the objectlist ================
[rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support'), rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure')]
=======================================
================start of subjObjList===================
[rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support'), rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure')]
==============end of subjObjList=============
uniqe subject/object dictionary
{0: u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl', 1: u'http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support', 2: u'http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure'}
================================
unique predicate list dictionary
{0: u'http://data.thespaceplan.com/ontologies/lsi#label'}
==================================
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predicate is: http://data.thespaceplan.com/ontologies/lsi#label
k2 is: 0
the object is: http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support
k3 is 1
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predicate is: http://data.thespaceplan.com/ontologies/lsi#label
k2 is: 0
the object is: http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure
k3 is 2
rows: defaultdict(<type 'list'>, {0: [0, 0]})
cols: defaultdict(<type 'list'>, {0: [1, 2]})
the triples are: defaultdict(<type 'list'>, {0: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), rdflib.term.URIRef(u'http://data.thespaceplan.com/ontologies/lsi#label'), rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support')], 1: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), rdflib.term.URIRef(u'http://data.thespaceplan.com/ontologies/lsi#label'), rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure')]})
the first one is:
[[ 0. 1. 1.]
[ 0. 0. 0.]
[ 0. 0. 0.]]
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity 0.0 (time to maturity pulled from children pages)
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://www.w3.org/2000/01/rdf-schema#comment For independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFields Health and Medicine
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#commercialStatus Research
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://purl.org/dc/terms/title Food Growing Methods
false file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost 0.0(investment cost pulled from children pages)
here is the attributes dictionary
defaultdict(<type 'list'>, {0: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity0.0 (time to maturity pulled from children pages)'], 1: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u"http://www.w3.org/2000/01/rdf-schema#commentFor independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input."], 2: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFieldsHealth and Medicine'], 3: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://data.thespaceplan.com/ontologies/lsi#commercialStatusResearch'], 4: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://purl.org/dc/terms/titleFood Growing Methods'], 5: [rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), u'http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost0.0(investment cost pulled from children pages)']})
=================================
here is the predicate object string list
[u'http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity0.0 (time to maturity pulled from children pages)', u"http://www.w3.org/2000/01/rdf-schema#commentFor independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.", u'http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFieldsHealth and Medicine', u'http://data.thespaceplan.com/ontologies/lsi#commercialStatusResearch', u'http://purl.org/dc/terms/titleFood Growing Methods', u'http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost0.0(investment cost pulled from children pages)']
=================================
here is the unique predicate object string
{0: u'http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity0.0 (time to maturity pulled from children pages)', 1: u"http://www.w3.org/2000/01/rdf-schema#commentFor independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.", 2: u'http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFieldsHealth and Medicine', 3: u'http://data.thespaceplan.com/ontologies/lsi#commercialStatusResearch', 4: u'http://purl.org/dc/terms/titleFood Growing Methods', 5: u'http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost0.0(investment cost pulled from children pages)'}
here is the subjectlist
[rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl'), rdflib.term.URIRef(u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl')]
==========================
here is the objectlist
[rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support'), rdflib.term.URIRef(u'http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure')]
==========================
here is the subject-object dictionary
{0: u'file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl', 1: u'http://localhost:8080/marmotta/ldp/waypaver-lsi/biological-support', 2: u'http://localhost:8080/marmotta/ldp/waypaver-lsi/habitation-infrastructure'}
the key is 0 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://data.thespaceplan.com/ontologies/lsi#averageEstTimetoMaturity0.0 (time to maturity pulled from children pages)
k2 ks: 0
the key is 1 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://www.w3.org/2000/01/rdf-schema#commentFor independence and resource optimization, some or all of the astronauts' diet must be grown in-situ. Various forms have been proposed, from greenhouses to hydroponics, but there must also be optimization in the types of food grown to maximize caloric and nutrient output compared to water and energy input.
k2 ks: 1
the key is 2 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://data.thespaceplan.com/ontologies/lsi#relatedIndustriesFieldsHealth and Medicine
k2 ks: 2
the key is 3 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://data.thespaceplan.com/ontologies/lsi#commercialStatusResearch
k2 ks: 3
the key is 4 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://purl.org/dc/terms/titleFood Growing Methods
k2 ks: 4
the key is 5 the subject is file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
the subject is: file:///home/brent/Downloads/Brents-Ext_RESCAL/oldfood.ttl
k1 is: 0
the predobj is http://data.thespaceplan.com/ontologies/lsi#averageEstInvestmentCost0.0(investment cost pulled from children pages)
k2 ks: 5
defaultdict(<type 'list'>, {0: [0, 0, 0, 0, 0, 0]})
defaultdict(<type 'list'>, {0: [0, 1, 2, 3, 4, 5]})
[[1 1 1 1 1 1]
[0 0 0 0 0 0]
[0 0 0 0 0 0]]
(0, 0) 1
(0, 1) 1
(0, 2) 1
(0, 3) 1
(0, 4) 1
(0, 5) 1
Objective function value: 0.002989004990059269777080697139
# of iterations: 3
no A is:
[[-0.7089591 0.7089591 ]
[ 0.50074365 0.50074365]
[ 0.50074365 0.50074365]]
the dimensions of A are:
(3, 2)
now V is:
[[-0.70517032 -0.70517032 -0.70517032 -0.70517032 -0.70517032 -0.70517032]
[ 0.70517032 0.70517032 0.70517032 0.70517032 0.70517032 0.70517032]]
the dimensions of V are:
(2, 6)
now R is
[array([[-0.70351417, -0.70351417],
[ 0.70351417, 0.70351417]])]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment