mil

Repo for master thesis

https://github.com/blubber-rubber/mil

Science Score: 31.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic links in README
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (0.8%) to scientific vocabulary

Keywords

multi-instance-learning
Last synced: 6 months ago · JSON representation ·

Repository

Repo for master thesis

Basic Info
  • Host: GitHub
  • Owner: blubber-rubber
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 21.6 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
multi-instance-learning
Created about 4 years ago · Last pushed almost 4 years ago
Metadata Files
Citation

Owner

  • Name: Ruben Vijverman
  • Login: blubber-rubber
  • Kind: user

Citation (CitationKNN.py)

from Utils import Owa_weights
from Utils.BagEncodings import *
from Utils.Distances import *


def citationKNN(X, test, k=5, dist=None, internal_dist=distance.euclidean, weight=None, encoding=None):
    if k >= len(X):
        return int(sum(bag.iloc[0, -1] for bag in X) / len(X) >= 0.5)
    distances = [math.inf] * k
    neighbour_classes = [None] * k
    for bag in X:
        if weight is not None:  # distances where weight should be passed on
            test_distance = dist(bag.iloc[:, 1:-1], test.iloc[:, 1:-1], internal_dist=internal_dist, weight=weight)
        elif encoding is not None:  # distances where encoding should be passed on
            test_distance = dist(bag.iloc[:, :-1], test.iloc[:, :-1], internal_dist=internal_dist, encoding=encoding)
        else:  # distances that do not use owa or encoding
            test_distance = dist(bag.iloc[:, 1:-1], test.iloc[:, 1:-1], internal_dist=internal_dist)
        index = k - 1
        while test_distance < distances[index] and index >= 0:
            index -= 1
        if index + 1 < k:
            distances.insert(index + 1, test_distance)
            neighbour_classes.insert(index + 1, bag.iloc[0, -1])
            distances = distances[:k]
            neighbour_classes = neighbour_classes[:k]
    return int(sum(neighbour_classes) / k >= 0.5)

GitHub Events

Total
Last Year