forked from wala/graph4code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind_hyperparameter_distributions.sparql
42 lines (38 loc) · 1.64 KB
/
find_hyperparameter_distributions.sparql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
PREFIX sio: <http://semanticscience.org/resource/>
PREFIX graph4code: <http://purl.org/twc/graph4code/>
PREFIX graph4codeOntology: <http://purl.org/twc/graph4code/ontology/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX schema: <http://schema.org/>
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
select * where {
graph ?g {
# find all estimators in sklearn for classifiers, get the parameter names for
# each classifier and its name
graph graph4code:docstrings {
?cls rdfs:subClassOf* <http://purl.org/twc/graph4code/python/sklearn.base.ClassifierMixin> .
?cls rdfs:label ?name .
?method dc:isPartOf ?cls .
?method graph4codeOntology:name_end "__init__" .
?method graph4codeOntology:param ?param .
?param rdfs:label ?param_name ;
graph4codeOntology:param_index ?param_index .
}
# find a call that is the constructor of those classes in ?cls, locate its source in text in
# ?l1 and ?l2 (lines in source) and capture the source text in ?txt
?clf rdfs:label ?name .
?clf sio:SIO_000061 ?p .
?p graph4code:lastLine ?l1 .
?p graph4code:firstLine ?l2 .
?clf schema:text ?txt .
# find all arguments passed into the constructor with the same named argument
# as a known parameter. Positional args are ignored because its unclear they match
# parameter names (TBD - need to fix this)
?clf sio:SIO_000230 ?anon .
?anon sio:SIO_000300 ?value .
?anon graph4code:flowsTo ?clf .
?anon sio:SIO_000116 ?param_name .
}
}