Error/Loss calculation in depth
This file contains 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 MATester(sc2.BotAI): | |
def __init__(self): | |
super().__init__() | |
self.map_data = MapData(self) | |
async def on_step(self, iteration: int): | |
reg1 = self.map_data.regions[1] | |
reg7 = self.map_data.regions[7] | |
p0 = reg1.center |
This file contains 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
D:\Users\elad\.virtualenvs\SC2MapAnalysis\Scripts\python.exe "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\pydevconsole.py" --mode=client --port=60982 | |
import sys; print('Python %s on %s' % (sys.version, sys.platform)) | |
sys.path.extend(['D:\\proj\\SC2MapAnalysis', 'D:/proj/SC2MapAnalysis']) | |
Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] | |
Type 'copyright', 'credits' or 'license' for more information | |
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help. | |
PyDev console: using IPython 7.16.1 |
This file contains 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
radon # radon cc . -a -nb (will dump only complexity score of B and below) | |
-- | |
mutmut # mutmut run --paths-to-mutate <folder / files> | |
-- | |
monkeytype # monkeytype run monkeytest.py | |
monkeytest.py | |
------------- | |
import pytest | |
pytest.main() |
This file contains 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 typing import Union, Tuple | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from sc2 import BotAI | |
from sc2.position import Point2 | |
from scipy.ndimage import binary_fill_holes, generate_binary_structure, label as ndlabel | |
from scipy.spatial import distance | |
from MapAnalyzer.constants import MIN_REGION_AREA, BINARY_STRUCTURE, MAX_REGION_AREA |
This file contains 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 django.utils.translation import ugettext_lazy as _ | |
from django.urls import reverse | |
from grappelli.dashboard import modules, Dashboard | |
from grappelli.dashboard.utils import get_admin_site_name | |
class CustomIndexDashboard(Dashboard): | |
""" | |
Custom index dashboard for www. |
This file contains 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 django.contrib import admin | |
from django_summernote.admin import SummernoteModelAdmin | |
from recms.models import * | |
class SupplierCmsObjectAdmin(SummernoteModelAdmin): # instead of ModelAdmin | |
summernote_fields = "__all__" |
This file contains 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
def solve_region_grid(self): | |
grid = binary_fill_holes(self.game_info.placement_grid.data_numpy).astype(int) | |
# chokes = np.where WORK IN PROGRESS | |
# compiled_grid = grid * (np.abs(scipy.ndimage.laplace(grid)) > 0) | |
compiled_grid = grid | |
s = generate_binary_structure(2, 2) | |
labeled_array, num_features = label(compiled_grid, structure=s) |
This file contains 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 Sc2botAI.BaseBot import BaseBot | |
import sys, os | |
sys.path.append(os.path.join(os.path.dirname(__file__), "../..")) | |
import logging | |
import random | |
import sc2 | |
from sc2 import Race, Difficulty | |
from sc2.constants import * | |
from sc2.player import Bot, Computer |
This file contains 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 PIL import Image | |
import cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pickle | |
from matplotlib import style | |
import time | |
style.use("ggplot") | |
SIZE = 10 |
NewerOlder