Skip to content

Instantly share code, notes, and snippets.

@msaget01
msaget01 / emp_turnover.md
Created December 3, 2024 07:02 — forked from chalg/emp_turnover.md
Decision Tree Classification models to predict employee turnover

Decision Tree Classification models to predict employee turnover

In this project I have attempted to create supervised learning models to assist in classifying certain employee data. The classes to predict are as follows:

  • Active - the employee is still in their role
  • Non-active - the employee has resigned

I pre-processed the data by removing one outlier and producing new features in Excel as the data set was small at 1056 rows. Some categorical features were also converted to numeric values in Excel. For example, Gender was originally "M" or "F", which was converted to 0 and 1 respectively. I also removed employee number as it provides no value as a feature and could compromise privacy.

After doing some research, see References, I found that the scikit-learn library does not handle categorical (string) features correctly in Decision Trees using the above approach. When added, these features provided no increase in accuracy, so I removed them. For example; Department, some departments have a highe

@msaget01
msaget01 / Graphs 2016_12_16.ipynb
Created January 30, 2022 01:03 — forked from inytar/Graphs 2016_12_16.ipynb
Graphs 2016_12_16
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@msaget01
msaget01 / ttr.py
Created January 30, 2022 00:34 — forked from chipgwyn/ttr.py
ticket to ride path finding with networkx
#!/usr/bin/env python
## Map based on https://cf.geekdo-images.com/images/pic38674.jpg
import networkx as nx
ttr_map = [
('vancouver', 'calgary', 3),
('vancouver', 'seattle', 1),
('seattle', 'calgary', 4),
class DijkstraPath():
def __init__(self, node_map):
self.node_map = node_map
self.node_length = len(node_map)
self.used_node_list = []
self.collected_node_dict = {}
def __call__(self, from_node, to_node):
self.from_node = from_node
self.to_node = to_node
self._init_dijkstra()
@msaget01
msaget01 / dijkstra.py
Created January 29, 2022 23:49 — forked from mdsrosa/dijkstra.py
Modified Python implementation of Dijkstra's Algorithm (https://gist.github.com/econchick/4666413)
from collections import defaultdict, deque
class Graph(object):
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):