Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code to calculate displacement factor for every test case in predict option #1

Open
wants to merge 167 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
dd1d869
change the prediction args option from modele to path_modele and from…
unmeshvrije Jul 5, 2018
1ab56e5
add code to calculate displacement factor for every test case when us…
unmeshvrije Jul 9, 2018
59acc69
add code to compute variance of embeddings to create subgraphs in sub…
unmeshvrije Jul 10, 2018
e1465d4
move the displacement calculation code from tester(predict option) to…
unmeshvrije Jul 12, 2018
47148c1
hole initial implementation
unmeshvrije Jul 30, 2018
e9fdc58
add files for hole implementation
unmeshvrije Jul 30, 2018
7d8f0df
overload loadFromFile and storeToFile for VarSubgraphs. Implement L3 …
unmeshvrije Aug 17, 2018
d7cf4d5
add minSubgraphSize parameter that tweaks minCard parameter for subgr…
unmeshvrije Aug 17, 2018
0fde3d6
small changes
jrbn Sep 25, 2018
3aaa2e2
several fixes and python code to check the embeddings
jrbn Sep 27, 2018
825638f
second distance value
unmeshvrije Sep 27, 2018
956ed18
fix conflict
unmeshvrije Sep 27, 2018
e918b1e
fix variance based distance calculation
unmeshvrije Oct 3, 2018
3a27b03
Merge branch 'jacopo_ml' of github.com:karmaresearch/trident into jac…
unmeshvrije Oct 3, 2018
a42cae5
implement KL divergence and now it can be give for subAlgo option for…
unmeshvrije Oct 8, 2018
624bbfc
add a new Jupyter notebook file to collect stats from the model
unmeshvrije Oct 18, 2018
6b43364
script now generates log for dynamic K
unmeshvrije Oct 18, 2018
39ab89b
add dynamicK option for formatTest
unmeshvrije Oct 18, 2018
c7ff44c
implement subanswers option that prints debug logs of all answers and…
unmeshvrije Oct 23, 2018
08bb9de
query-wise answer accuracy is calculated using expected and actual an…
unmeshvrije Oct 24, 2018
ff0d9af
Merge branch 'master' into unmesh
unmeshvrije Oct 24, 2018
fb47f5d
nothing
jrbn Oct 29, 2018
4a8ca55
update notebook files, convert them into python file
unmeshvrije Nov 6, 2018
ff9e5de
Merge branch 'master' into unmesh
unmeshvrije Nov 6, 2018
f90ee10
add kFile option and possibiity to process it during evaluation
unmeshvrije Nov 7, 2018
1096aac
Merge branch 'master' into jacopo_ml
jrbn Nov 17, 2018
aee8eaa
search in maximum 10 subgraphs when choosing dynamic k based on avera…
unmeshvrije Nov 28, 2018
b72b935
load embeddings file with 64 bit binarized embeddings
unmeshvrije Nov 28, 2018
e8dd12f
select binary embeddings for tail embeddings
unmeshvrije Nov 29, 2018
19b1c25
fixbug: binarized embeddings subeval correctly check from isAnswerInS…
unmeshvrije Nov 30, 2018
8bd412c
add logic to do check binarized embeddings for transe predict
unmeshvrije Nov 30, 2018
6c3f9d7
bugfix: read compression size times bytes instead of dim of embeddings
unmeshvrije Nov 30, 2018
5eb4742
Merge branch 'master' into unmesh
CerielJacobs Dec 3, 2018
7fb018b
Merge branch 'master' into unmesh
CerielJacobs Dec 4, 2018
61402cb
binary tester closeness function based on xor
unmeshvrije Dec 12, 2018
ff7c328
rectify closeness and subtraction functions
unmeshvrije Dec 12, 2018
472a42b
Merge branch 'master' of github.com:karmaresearch/trident
unmeshvrije Dec 23, 2018
92c0c2a
Merge branch 'master' into unmesh
unmeshvrije Dec 23, 2018
2aac801
Merge remote-tracking branch 'origin/master' into unmesh
CerielJacobs Jan 23, 2019
58ac4c2
Merge remote-tracking branch 'origin/master' into unmesh
CerielJacobs Jan 24, 2019
605c72e
attempt to make hole training faster
unmeshvrije Feb 7, 2019
e9c7b6e
Merge branch 'master' into unmesh
unmeshvrije Feb 7, 2019
119b8d7
Merge remote-tracking branch 'origin/unmesh' into unmesh
CerielJacobs Feb 15, 2019
267c05e
Refactored to use a memory-mapped file for the raw data of the embedd…
CerielJacobs Feb 15, 2019
a7e90a9
Merge remote-tracking branch 'origin/unmesh' into unmesh
CerielJacobs Feb 25, 2019
a14e6d3
use fftw library to compute circular correlation
unmeshvrije Mar 4, 2019
ba8c917
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Mar 4, 2019
10a6bdf
Various fixes
CerielJacobs Mar 5, 2019
47b3e9f
Merge branch 'unmesh' into jacopo_ml
jrbn Mar 6, 2019
ee9e8bf
merged from master
jrbn Mar 6, 2019
d763845
Merge branch 'jacopo_ml' of github.com:karmaresearch/trident into jac…
jrbn Mar 6, 2019
c3f5373
removed unused notebooks
jrbn Mar 6, 2019
14845b8
removed unnecessary code
jrbn Mar 6, 2019
9dbdae4
added more logging
jrbn Mar 6, 2019
72732cc
changed the way we store embeddings using memory mapped files
jrbn Mar 6, 2019
92c962b
removed debugging
jrbn Mar 6, 2019
bcc408c
merged
jrbn Mar 6, 2019
2de7727
remove fftw library
unmeshvrije Mar 6, 2019
d6cd0f7
merge conflict
unmeshvrije Mar 6, 2019
7ead407
reintroduced memory-based embedding storage
jrbn Mar 6, 2019
577e762
Merge branch 'jacopo_ml' of github.com:karmaresearch/trident into jac…
jrbn Mar 6, 2019
55b5f9f
removed logging
jrbn Mar 6, 2019
644d4a4
merged
jrbn Mar 6, 2019
f89d5a0
Precompute sin and cos, just to make testing faster
CerielJacobs Mar 6, 2019
9fe8c3e
bugfix
jrbn Mar 6, 2019
b3f5afe
Cache computation of sin and cos (but this does not help much)
CerielJacobs Mar 7, 2019
49ed78a
Initialize field "loss"
CerielJacobs Mar 7, 2019
577780c
test array was too small
CerielJacobs Mar 7, 2019
5df98f9
add intersection method for answers
unmeshvrije Mar 7, 2019
f921af1
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Mar 7, 2019
c029a4d
merge conflict
unmeshvrije Mar 7, 2019
03ab6d6
add comments. fix sigmoid function bug
unmeshvrije Mar 8, 2019
a4c6a83
add third method for selecting answers. renaming
unmeshvrije Mar 9, 2019
08da185
bugfix embedding load suffix .0 is added to E or R
unmeshvrije Mar 9, 2019
2937ba8
logs and metrics
unmeshvrije Mar 9, 2019
22dc887
compute micro and macro average of precision and recall for test queries
unmeshvrije Mar 11, 2019
f7e2214
comment find answers code and add intersection, interunion options in…
unmeshvrije Mar 12, 2019
ab947f3
bugfixes
jrbn Mar 12, 2019
91381dd
rename a few variables. compute totalSize based on all subgraphs in topk
unmeshvrije Mar 12, 2019
efd5d74
written experimental python module to access the embeddings from python
jrbn Mar 12, 2019
4fcf764
bugfixes
jrbn Mar 15, 2019
449cc67
bugfixes
jrbn Mar 15, 2019
82fe8a5
fix l3 distance, use union of subgraphs, data type fix
unmeshvrije Mar 15, 2019
62fa273
Merge branch 'jacopo_ml' into unmesh
unmeshvrije Mar 15, 2019
4ed19f3
add option for calculate displacement default is false
unmeshvrije Mar 15, 2019
dc90768
Finally: convergence for hole
CerielJacobs Mar 18, 2019
1d269ce
Merge remote-tracking branch 'origin/unmesh' into unmesh
CerielJacobs Mar 18, 2019
f582932
small optim
CerielJacobs Mar 18, 2019
016c74d
A bit of speedup with the current fft
CerielJacobs Mar 18, 2019
047db83
Use Kiss FFT instead of our own, since it is much faster
CerielJacobs Mar 19, 2019
5093847
Disabled OPENMP code (slowed things down a lot)
CerielJacobs Mar 19, 2019
52baf7a
implement dynamic K based on avg ranks from validation set
unmeshvrije Mar 20, 2019
5e0e4f8
recompute threshold for % based threshold input should be 101=> 1%, 1…
unmeshvrije Mar 20, 2019
c68498b
bugfix calculate correct %k top subgraphs
unmeshvrije Mar 20, 2019
c16126d
more logs and some optimization
unmeshvrije Mar 22, 2019
2511bad
compute dynamic k based on max
unmeshvrije Mar 22, 2019
af5554b
added api
jrbn Mar 25, 2019
0700f09
added apis to the embedding class
jrbn Mar 26, 2019
81375d8
Merge branch 'jacopo_ml' into local_ml
jrbn Mar 26, 2019
7a65ff0
Merge branch 'jacopo_ml' into unmesh
unmeshvrije Mar 28, 2019
e121de3
Merge branch 'master' into local_ml
jrbn Mar 29, 2019
568808e
bugfixes
jrbn Apr 3, 2019
69284fa
bug on the python bindings
jrbn Apr 3, 2019
f33367c
improving the python bindings
jrbn Apr 4, 2019
2405cf4
cache for dynamic K, intersection with % and sampling test and valida…
unmeshvrije Apr 5, 2019
f1bd513
bugfix sample triples
unmeshvrije Apr 5, 2019
de37dc3
sample validation triples only for dynamic case. additional condition…
unmeshvrije Apr 5, 2019
cdc3ddc
bugfixes
jrbn Apr 5, 2019
e0832b5
bugfixes
jrbn Apr 5, 2019
1916df1
sampleTest option added. sample subgraph function and timerd added
unmeshvrije Apr 5, 2019
3540dc9
merge conflict resolved with jacopo_ml branch
unmeshvrije Apr 5, 2019
ba4b03b
make threshold consistent.
unmeshvrije Apr 5, 2019
af8c170
find union of entities only if there was a HIT
unmeshvrije Apr 6, 2019
9541c14
embeddings read in ro mode
jrbn Apr 6, 2019
be8a280
Merge branch 'jacopo_ml' of github.com:karmaresearch/trident into jac…
jrbn Apr 6, 2019
1177ee4
Merge branch 'jacopo_ml' into unmesh
jrbn Apr 6, 2019
114c59e
remove test triples with literals
unmeshvrije Apr 6, 2019
9640170
add removeLiterals option for subgraph creation
unmeshvrije Apr 7, 2019
0459c68
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
jrbn Apr 7, 2019
267d51e
changed the code to detect literals
jrbn Apr 7, 2019
480fc5e
remove code to write to a test file
unmeshvrije Apr 7, 2019
96e0a99
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Apr 7, 2019
aa44236
bugfixes on my previous change
jrbn Apr 7, 2019
05deb30
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
jrbn Apr 7, 2019
65c32f3
comment debug logs
unmeshvrije Apr 8, 2019
ab8aa0d
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Apr 8, 2019
df6a224
added a program that creates a db from batch
jrbn Apr 8, 2019
7711865
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
jrbn Apr 8, 2019
7747442
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Apr 9, 2019
5876151
logs and timer
unmeshvrije Jun 19, 2019
a9be49c
add faiss library approx nearest neighbour code: log ids of entities …
unmeshvrije Jun 24, 2019
70f5048
attempt of making ANN work with FAISS lib.
unmeshvrije Jun 25, 2019
e24f248
tail results with ANN
unmeshvrije Jun 28, 2019
f180053
fixing compilation issues
jrbn Jul 5, 2019
e83006a
changed subanswers to answer
jrbn Jul 5, 2019
0fdcf44
support distmul
unmeshvrije Jul 5, 2019
1cd8327
better tail predictions with IVFPQ, use float* instead of vector<float>
unmeshvrije Jul 6, 2019
5e1c6d9
adding a web interface for the link prediction
jrbn Jul 8, 2019
3c7d59d
merged
jrbn Jul 8, 2019
8cc5a86
ann algo implemented in subcreate and subeval. results with head pred…
unmeshvrije Jul 8, 2019
6befa28
find answers to queries using ANN method. use topK = expected number …
unmeshvrije Jul 12, 2019
af32f27
combine ann and var for finding answers. improves precision for head …
unmeshvrije Jul 12, 2019
6b85b4a
first implementation of subgraph selection for the web interface
jrbn Jul 14, 2019
1104072
starting implementing ANN
jrbn Jul 14, 2019
5ec63e6
merged the last updates
jrbn Jul 14, 2019
15fc817
added logging
jrbn Jul 15, 2019
6ee8b20
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Jul 15, 2019
b4c38e7
added conditional probabilities
jrbn Jul 16, 2019
15871af
added script
jrbn Jul 16, 2019
9644c29
separate faiss related code in a wrapper
unmeshvrije Jul 17, 2019
f10ce88
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Jul 17, 2019
970aa9d
more clean up in faiss wrapper
unmeshvrije Jul 17, 2019
fa507c4
factor out dynamic cache code and remove ann code from subgraphs file
unmeshvrije Jul 17, 2019
ef95e61
make ann work in trident and subgraphs
unmeshvrije Aug 14, 2019
a16b187
compile with python and export function for loadTriples
unmeshvrije Aug 21, 2019
0ed205e
fix batch reading from valid path
unmeshvrije Sep 11, 2019
68f7896
debug
CerielJacobs Sep 12, 2019
ff0a61c
Merge remote-tracking branch 'origin/unmesh' into unmesh
CerielJacobs Sep 12, 2019
003f84f
Made to compile with python support
CerielJacobs Sep 13, 2019
a05a681
log search time for subgraph calculation
unmeshvrije Sep 14, 2019
f00ce20
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Sep 14, 2019
20cc28c
distmul helper functions
unmeshvrije Sep 17, 2019
366799c
Added some comments and a bug fix
CerielJacobs Sep 19, 2019
294dc33
Merge remote-tracking branch 'origin/unmesh' into unmesh
CerielJacobs Sep 19, 2019
09e110a
some command changes
unmeshvrije Sep 20, 2019
56bce5a
Merge branch 'unmesh' of github.com:karmaresearch/trident into unmesh
unmeshvrije Sep 23, 2019
46ffe04
Improving holE implementation
CerielJacobs Sep 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 41 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ if(SERVER)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -DSERVER=1")
message("SERVER forces the enabling of SPARQL")
set(SPARQL "1")
set(ML "1")
ENDIF()
IF(SPARQL)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -DSPARQL=1")
ENDIF()
IF(PYTHON)
message("PYTHON forces the enabling of ML and ANALYTICS")
set(ML "1")
set(ANALYTICS "1")
set(ANALYTICS "0")
ENDIF()
if(ANALYTICS)
set(COMPILE_FLAGS "${COMPILE_FLAGS} -DANALYTICS=1")
Expand All @@ -52,9 +53,9 @@ ENDIF()

#Set compiler options
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DDEBUG")
set(COMPILE_FLAGS "-c -fPIC -std=c++11 -Wall -Wno-sign-compare ${COMPILE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DDEBUG")
set(COMPILE_FLAGS "-c -fPIC -std=c++11 -Wall -Wno-sign-compare ${COMPILE_FLAGS}")
endif()

#Set to release mode if nothing is specified
Expand Down Expand Up @@ -183,9 +184,37 @@ IF(ML)
"src/trident/mining/*.cpp"
"src/trident/ml/*.cpp"
src/trident/mining/miner.cpp)

# Install FAISS
set(CMAKE_PREFIX_PATH /cm/shared/apps/open64/4.5.2.1/lib)
#find_library(omp omp)
find_package(OpenMP QUIET)
if (OPENMP_FOUND)
message("OpenMP found")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
find_library(openblas openblas PATHS /cm/images/MLNX-centos74-MIC-image/cm/shared/apps/openblas/0.2.18/lib)
ExternalProject_Add(git-faiss
DOWNLOAD_COMMAND git clone https://github.com/facebookresearch/faiss.git
DOWNLOAD_DIR .
SOURCE_DIR faiss/
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE 1
BUILD_COMMAND "export" "CXX=/cm/shared/package/gcc/4.9.3/bin/g++ -std=c++11" && "export" "CPUFLAGS=-msse4 -mpopcnt" && "export" "" && "export" "LDFLAGS=-fPIC -fopenmp " && "export" "CPPFLAGS=-fPIC -m64 -Wall -g -O3 -Wno-sign-compare -DFINTEGER=int -fopenmp " && make -j libfaiss.a
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(git-faiss SOURCE_DIR)
include_directories(${SOURCE_DIR}/..)
add_library(faiss STATIC IMPORTED)
add_dependencies(faiss git-faiss)
set(FAISS_LIB "${CMAKE_BINARY_DIR}/faiss")
set_property(TARGET faiss PROPERTY IMPORTED_LOCATION "${FAISS_LIB}/libfaiss.a")

set(COMPILE_FLAGS "-DFINTEGER=int -m64 -msse4 ${COMPILE_FLAGS}")
add_library(trident-ml SHARED ${ml_SRC})
set_target_properties(trident-ml PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
TARGET_LINK_LIBRARIES(trident-ml kognac-core trident-core)
TARGET_LINK_LIBRARIES(trident-ml kognac-core trident-core faiss ${openblas})
TARGET_LINK_LIBRARIES(trident trident-ml)
ENDIF()

Expand Down Expand Up @@ -242,7 +271,7 @@ IF (SERVER)

add_library(trident-web SHARED ${webserver_SRC})
set_target_properties(trident-web PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
TARGET_LINK_LIBRARIES(trident-web kognac-core trident-core trident-sparql)
TARGET_LINK_LIBRARIES(trident-web kognac-core trident-core trident-sparql trident-ml)
TARGET_LINK_LIBRARIES(trident trident-web)
ENDIF()

Expand All @@ -251,9 +280,11 @@ IF(PYTHON)
include(FindPkgConfig)
set(Python_ADDITIONAL_VERSIONS 3.5)
pkg_check_modules(PY3 REQUIRED QUIET python3)
find_package(PythonLibs REQUIRED)
IF(PY3_FOUND)
INCLUDE_DIRECTORIES(${PY3_INCLUDE_DIRS})
LINK_DIRECTORIES(${PY3_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS})
LINK_DIRECTORIES(${PYTHON_LIBRARY})
message("Python include path = ${PYTHON_INCLUDE_DIRS}")
ENDIF()
#NumPY
if(NOT PYTHON_EXECUTABLE)
Expand All @@ -270,6 +301,7 @@ IF(PYTHON)
COMMAND "${PYTHON_EXECUTABLE}" -c
"from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
OUTPUT_VARIABLE __numpy_path)
message("numpy path : ${__numpy_path}")
# And the version
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c
Expand All @@ -294,7 +326,7 @@ IF(PYTHON)
add_library(tridentp SHARED ${tridentp_SRC}) #Python library
set_target_properties(tridentp PROPERTIES OUTPUT_NAME "trident" PREFIX "" SUFFIX ".so")
set_target_properties(tridentp PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
TARGET_LINK_LIBRARIES(tridentp trident-core trident-ml trident-ana ${PY3_LIBRARIES})
TARGET_LINK_LIBRARIES(tridentp trident-core trident-ml ${PY3_LIBRARIES})
ENDIF()

if(JAVA)
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,22 @@ problem. To check SNAP has been correctly compiled, make sure that the file

## License

Trident is released under Apache 2 license. In the source directory
Trident is released under Apache 2 license.

In the source directory
there is one directory called "rdf3x". This directory
contains a modified version of the RDF3X engine written by <a
href="https://db.in.tum.de/~neumann/">Thomas Neumann</a>. The source code of
RDF3X was released on google code but unfortunately that repository is no
longer available. The original version of RDF3X is released with Creative
Commons. In order to comply with the original license, also this modified
version should be considered released with the same license. There is another directory, called "snap", which contains a modified version of the SNAP library developed at
version should be considered released with the same license.

There is another directory, called "snap", which contains a modified version of the SNAP library developed at
Stanford (<a href="http://snap.stanford.edu/snap/index.html">Here</a> is the
link to the homepage of the project). I modified the code of SNAP in order to
make it more efficient and to be able to scale up to larger graphs. My changes are contained in the "snap", "src/snap" and "include/snap" directories. Since the original version of SNAP is
released with the BSD license, then also my modifications are released with
the same license. This means that everything under these three directories should be considered released under BSD while everything in the directory "rdf3x" should be considered under Creative Commons.
released with the BSD license, my modifications are released with the same license.

This project contains parts of Kiss FFT (https://github.com/mborgerding/kissfft) which is released with
the 3-clause BSD license. We only modified it to use double instead of float.
14 changes: 7 additions & 7 deletions include/layers/TridentLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class TridentLayer : public DBLayer {
bifSampl(true), nindices(kb.getNIndices()), supportBuffer(new
char[MAX_TERM_SIZE]) { }

DDLEXPORT bool lookup(const std::string& text,
DDLEXPORT bool lookup(const std::string& text,
::Type::ID type,
unsigned subType,
uint64_t& id);
Expand All @@ -178,13 +178,13 @@ class TridentLayer : public DBLayer {
bifSampl = false;
}

DDLEXPORT bool lookupById(uint64_t id,
DDLEXPORT bool lookupById(uint64_t id,
const char*& start,
const char*& stop,
::Type::ID& type,
unsigned& subType);

DDLEXPORT bool lookupById(uint64_t id,
DDLEXPORT bool lookupById(uint64_t id,
char *output,
size_t &length,
::Type::ID& type,
Expand All @@ -200,13 +200,13 @@ class TridentLayer : public DBLayer {
uint64_t value3,
uint64_t value3C);

DDLEXPORT double getScanCost(DBLayer::DataOrder order,
DDLEXPORT double getScanCost(DBLayer::DataOrder order,
uint64_t value1,
uint64_t value1C,
uint64_t value2,
uint64_t value2C);

DDLEXPORT double getJoinSelectivity(bool valueL1,
DDLEXPORT double getJoinSelectivity(bool valueL1,
uint64_t value1CL,
bool value2L,
uint64_t value2CL,
Expand All @@ -219,7 +219,7 @@ class TridentLayer : public DBLayer {
bool value3R,
uint64_t value3CR);

DDLEXPORT double getScanCost(DBLayer::DataOrder order,
DDLEXPORT double getScanCost(DBLayer::DataOrder order,
uint64_t value1,
uint64_t value1C);

Expand All @@ -233,7 +233,7 @@ class TridentLayer : public DBLayer {
return kb.getNTerms();
}

DDLEXPORT std::unique_ptr<DBLayer::Scan> getScan(const DBLayer::DataOrder order,
DDLEXPORT std::unique_ptr<DBLayer::Scan> getScan(const DBLayer::DataOrder order,
const DBLayer::Aggr_t,
Hint *hint);

Expand Down
13 changes: 11 additions & 2 deletions include/python/trident.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
#ifndef _PYTHON_H
#define _PYTHON_H

//#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION

#include <Python.h>
#include <trident/kb/kb.h>
#include <trident/kb/querier.h>
#include <trident/ml/batch.h>
#include <trident/ml/embeddings.h>

#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION

typedef struct {
PyObject_HEAD
Expand All @@ -44,8 +45,16 @@ typedef struct {
char pos;
} trident_Itr;

typedef struct {
PyObject_HEAD
std::shared_ptr<Embeddings<double>> E;
std::shared_ptr<Embeddings<double>> R;
} trident_Emb;


extern PyTypeObject trident_ItrType;
extern PyTypeObject trident_DbType;
extern PyTypeObject trident_EmbType;

typedef struct {
PyObject_HEAD
Expand Down
Loading