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 qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister | |
from qiskit import * | |
import numpy as np | |
qc = QuantumCircuit(3,1) | |
weights = np.random.rand(18) | |
# First layer | |
qc.u3(weights[0],weights[1],weights[2],0) | |
qc.u3(weights[3],weights[4],weights[5],1) | |
qc.u3(weights[6],weights[7],weights[8],2) |
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 qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister | |
from qiskit import * | |
import numpy as np | |
weights = np.random.rand(18) | |
# First layer | |
qc.u3(weights[0],weights[1],weights[2],0) | |
qc.u3(weights[3],weights[4],weights[5],1) | |
qc.u3(weights[6],weights[7],weights[8],2) | |
qc.cnot(0,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
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn import svm | |
X = np.array([[-1,-2],[2,6],[-1.5,-2.8],[4,4],[-1,-9.6], [9,11]]) | |
y = [0,1,0,1,0,1] | |
clf = svm.SVC(kernel='linear', C = 1.0,tol=1e-12,random_state=5) |
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
import sys | |
from PIL import Image | |
def calculate_brightness(image): | |
greyscale_image = image.convert('L') | |
histogram = greyscale_image.histogram() | |
pixels = sum(histogram) | |
brightness = scale = len(histogram) |