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
| #!/usr/bin/sh | |
| ########################## Color Codes ########################## | |
| # Reset | |
| Color_Off='\033[0m' # Text Reset | |
| # Regular Colors | |
| Black='\033[0;30m' # Black | |
| Red='\033[0;31m' # Red | |
| Green='\033[0;32m' # Green |
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 typing import Generic | |
| from typing import Iterable | |
| from typing import TypeVar | |
| # Generic type. | |
| T = TypeVar('T') | |
| class Vector(Generic[T]): | |
| """A light-weight Vector utility class, used to perform various operations |
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
| """ | |
| A program to determine if a number is a perfect number. | |
| """ | |
| def is_perfect_number(n): | |
| """Determines if a given number is a perfect number. | |
| Any number can be perfect number, if the sum of its | |
| positive divisors excluding the number itself is equal |
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
| """Improved estimation of how many lines of codes are in a project (using recursion) | |
| @author | |
| Victor I. Afolabi | |
| Director of AI, NioCraft, 115Garage. | |
| Email: javafolabi@gmail.com | |
| GitHub: https://github.com/victor-iyiola | |
| @project | |
| File: lines-of-code.py |
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
| """ | |
| @author Victor I. Afolabi | |
| A.I. Engineer & Software developer | |
| javafolabi@gmail.com | |
| Created on 05 October, 2017 @ 03:35 PM. | |
| Copyright (c) 2017. Victor. All rights reserved. | |
| """ |
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
| # Shape = 2x3 | |
| a = [ | |
| [1, 2, 3], | |
| [4, 5, 6] | |
| ] | |
| # Shape = 2x3x2 | |
| b = [ | |
| [[1, 1], [2, 2], [3, 3]], | |
| [[4, 4], [5, 5], [6, 6]] |
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
| W0 = 2 * np.random.random(size=[input_dim, hidden_dim]) - 1 | |
| W1 = 2 * np.random.random(size=[hidden_dim, output_dim]) - 1 |
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
| W0 = 2 * np.random.random(size=[input_dim, hidden_dim]) - 1 | |
| W1 = 2 * np.random.random(size=[hidden_dim, output_dim]) - 1 |
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
| for i in range(10000): | |
| # Forward propagte our input to get a prediction | |
| l1 = sigmoid(np.dot(X, W0)) | |
| l2 = sigmoid(np.dot(l1, W1)) | |
| # Estimate how much we missed | |
| l2_error = (y - l2) ** 2 | |
| l2_delta = l2_error * sigmoid(l2, prime=True) | |
| # Back propagate error in layer 2 into layer 1 |
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
| def sigmoid(Z, prime=False): | |
| if prime: | |
| return Z * (1 - Z) | |
| return 1 / (1 + np.exp(-Z)) |