This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Course: https://www.edx.org/learn/computer-programming/universite-catholique-de-louvain-constraint-programming | |
# Backtracking search algorithm for solving n-queens problem | |
import time | |
from typing import Callable | |
class NQueensFilter: | |
def __init__(self, number_of_queens: int): | |
self._number_of_queens: int = number_of_queens |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Knapsack library by ortools | |
# Translated from c++ code: | |
# https://github.com/google/or-tools/blob/stable/ortools/algorithms/knapsack_solver.h | |
# https://github.com/google/or-tools/blob/stable/ortools/algorithms/knapsack_solver.cc | |
import bisect | |
import heapq | |
import math | |
from ortools.linear_solver import pywraplp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABC, abstractmethod | |
class EnemyShipBuilding(ABC): | |
@abstractmethod | |
def make_enemy_ship(self, type_of_ship: str) -> "EnemyShip": | |
pass | |
def order_the_ship(self, type_of_ship: str) -> "EnemyShip": | |
the_enemy_ship = self.make_enemy_ship(type_of_ship) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _FootballPlayer: | |
def __init__( | |
self, | |
passer_rating: int, | |
rushing_yard: int, | |
receiving_yard: int, | |
total_tackles: int, | |
interceptions: int, | |
avg_punt: int, | |
avg_kick_off_return: int, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
:: This batch file helps in automating tasks on cmd. | |
:: First, we sort inports using isort package. | |
:: Then, we remove unused imports using autoflake package. | |
:: Finally, we format using black package. | |
TITLE Python Files Formatter | |
ECHO /!\ Please make sure you have the following packages installed: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of license header: | |
# Unauthorized copying of this file, via any medium is strictly prohibited | |
# Proprietary and confidential | |
"""This file contains utility classes and functions.""" | |
import json | |
import logging | |
import openpyxl | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Creates a file which contains info from lp and sol file. | |
---------------- | |
Sample sol file: | |
---------------- | |
# Solution for model Mathematical Model | |
# Objective value = 140 | |
x1 10 | |
x2 20 | |
x3 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""https://www.coursera.org/learn/ml-foundations?specialization=machine-learning#about | |
https://songxia-sophia.medium.com/collaborative-filtering-recommendation-with-co-occurrence-algorithm-dea583e12e2a | |
https://towardsdatascience.com/recommend-using-scikit-learn-and-tensorflow-recommender-bc659d91301a | |
""" | |
import numpy | |
import pandas | |
from scipy import sparse | |
from sklearn import metrics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""https://www.coursera.org/learn/ml-foundations?specialization=machine-learning#about""" | |
import pandas | |
from sklearn import neighbors | |
from sklearn import metrics | |
from sklearn.feature_extraction import text | |
if __name__ == "__main__": | |
people_df = pandas.read_csv("people_wiki.csv") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""https://www.coursera.org/learn/ml-foundations?specialization=machine-learning#about""" | |
from matplotlib import pyplot | |
import pandas | |
import seaborn | |
from sklearn import linear_model | |
from sklearn import model_selection | |
from sklearn import metrics | |
from sklearn.feature_extraction import text |
NewerOlder