Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
""" MIT License """
import matplotlib.pyplot as plt
import numpy as np
from bokeh.plotting import figure, show, output_file, save
from bokeh.embed import file_html, components
from bokeh.resources import CDN
X = np.array([0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 12, 13, 14, 15], dtype=np.float32)
# coding=utf-8
from Queue import Queue
def bfs(instance):
closed = set() # zbiór zamknięty
#inicjujemy zbiór otwarty stanem początkowym. Decyzję ustawiamy na null
#koszt na 0 - nie ma to znaczenia. Rodzicem jest również null (jest to
#korzeń drzewa
#fringe dla BFS jest kolejką
#enqueue - put
# coding=utf-8
def dfs(instance):
closed = set() # zbiór zamknięty
#inicjujemy zbiór otwarty stanem początkowym. Decyzję ustawiamy na null
#koszt na 0 - nie ma to znaczenia. Rodzicem jest również null (jest to
#korzeń drzewa
#formalnie jest to lista, ale jest używana jako stos
#pop - pop
#push - append
fringe = [[(instance.get_start_state(), None, 0), None]]
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
The Art of an Artificial Intelligence
http://art-of-ai.com
https://github.com/artofai
"""
__author__ = 'xevaquor'
__license__ = 'MIT'
class Perceptron(object):
def __init__(self, initial_weights=None):
self.w = initial_weights
self.training_error = None
def activation(self, v):
return v > 0
def train_perceptron(self, TrainingData, learning_rate=0.05,
iterations=2000, callback_frequency=10,
@Xevaquor
Xevaquor / 0_reuse_code.js
Last active August 29, 2015 14:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
SELECT MAX(placa_pod) as maximum, MIN(placa_pod) as minimum, MAX(placa_pod) - MIN(placa_pod) as roznica FROM pracownicy
select etat, avg(PLACA_POD) as srednia FROM pracownicy GROUP BY etat ORDER BY srednia desc
select count(*) from pracownicy where etat = 'PROFESOR'
select ID_ZESP, SUM(placa_pod + NVL(placa_dod, 0)) as sumaryczne_place from pracownicy group by id_zesp
select MAX(SUM(placa_pod + NVL(placa_dod, 0))) as max_sumaryczne_place from pracownicy group by id_zesp
$MOD52
JMP START
ORG 0003H
;MOV P2, #00000111B
INC A
CALL DELAY
RETI
# coding=utf-8
class DomainException(Exception):
pass
class Colour(object):
def __init__(self):
pass
Red, Green, Blue = range(3)
# coding=utf-8
class DomainException(Exception):
pass
class Variable(object):
def __init__(self, fixed_value=None):
# załpżono, że dziedzina dla wszystkich zmiennych jest taka sama [1..20]
# ale równie dobrze może być przekazywana do konstruktora
self.domain = range(1,21) if fixed_value is None else [fixed_value]
self._value = fixed_value