Skip to content

Instantly share code, notes, and snippets.

View klintan's full-sized avatar

Andreas Klintberg klintan

View GitHub Profile
@klintan
klintan / ros2_debugging.txt
Last active August 20, 2020 05:18
Ros2 debugging using lldb
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
lldb -f arke_base/install/arke_base/lib/arke_base/arke_hardware_interface_node -- --ros-args --params-file arke_base/config/arke_diff_drive_controller.yaml
title: Kitti ROSBAG 2011-09-26_drive_0002_synced
shortname: kitti
description: >
Kitti LIDAR, camera, IMU and GPS data.
references:
- http://www.cvlibs.net/datasets/kitti/raw_data.php
@klintan
klintan / basic_launch_template.launch.py
Created February 3, 2020 08:16
Basic ROS2 launch template
from launch import LaunchDescription, LaunchIntrospector, LaunchService
from launch_ros import actions, get_default_launch_description
def generate_launch_description():
node = actions.Node(
package='', node_executable='', output='screen')
return LaunchDescription([plan_route])
@klintan
klintan / build.sh
Last active June 23, 2019 20:41
AirSim setup.sh and build.sh modified for Mac
#! /bin/bash
# get path of current script: https://stackoverflow.com/a/39340259/207661
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd "$SCRIPT_DIR" >/dev/null
set -e
# set -x
#check for correct verion of llvm
@klintan
klintan / implicates_sample.py
Created October 10, 2018 06:21
Implication sample for two facts
sigma_f = 0.9 + 0.9 * ( 0.8*0.9 + 0.6*-0.3)
@klintan
klintan / compute_error.py
Created September 7, 2018 23:41
Truthfinder 9
error = 1 - np.dot(list(source_trustworthiness.values()), list(source_trustworthiness_old.values()) / (
np.linalg.norm(list(source_trustworthiness.values())) * np.linalg.norm(
list(source_trustworthiness_old.values()))))
@klintan
klintan / compute_source_trust.py
Last active January 3, 2020 21:35
Truthfinder 8
def compute_source_trust(data, sources):
'''
Compute every source trustworthiness. The trustworthiness score is the average confidence of
all facts supplied by source w
:param data: Dataframe all facts for object O
:param sources: dict all unique sources and current scores
:return: dict of unique sources with updated scores
'''
for source in sources:
# t(w) trustworthiness of website w
def compute_final_confidence(data, confidence):
for idx, claim in data.iterrows():
data.at[idx, 'confidence'] = 1 / (1 + np.exp(-DAMPING_FACTOR * claim['confidence']))
return (data, confidence)
@klintan
klintan / implicates.py
Last active October 10, 2018 08:19
Truthfinder 6
import jellyfish
def implicates(fact, fact_sources):
'''
How many sources implicates this fact
:param fact: dataframe row
:param fact_sources: dataframe
:return:
'''
return [jellyfish.jaro_winkler(fact.lower(),f.lower()) - 0.5 for f in fact_sources]
def compute_confidence_score_with_similarity(data, confidence, attribute_key):
'''
Compute the confidence score of a claim based on its already computed confidence score
and the similarity between it and the other claims.
Then set the confidence value to this new confidence computed with similarity measure.
'''
# get unique facts for object
facts_set = data[attribute_key].unique()
# create fact : confidence dict
facts_confidence = {x[attribute_key]: x['confidence'] for _, x in data.iterrows()}