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
| <?php | |
| declare(strict_types=1); | |
| namespace pocketmine\phpstan\rules; | |
| use Generator; | |
| use PhpParser\Node\Arg; | |
| use PhpParser\Node\Expr\ArrayItem; | |
| use PhpParser\Node\Expr\Assign; |
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
| <?php | |
| declare(strict_types=1); | |
| use pocketmine\nbt\tag\CompoundTag; | |
| use pocketmine\player\Player; | |
| use pocketmine\Server; | |
| $server = Server::getInstance(); | |
| assert(isset($sender) && $sender instanceof Player); |
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
| <?php | |
| declare(strict_types=1); | |
| use cosmicpe\CosmicPE; | |
| use pocketmine\block\Block; | |
| use pocketmine\block\BlockTypeIds; | |
| use pocketmine\block\Liquid; | |
| use pocketmine\block\VanillaBlocks; | |
| use pocketmine\event\EventPriority; |
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
| <?php | |
| final class AdjacencyMatrix{ | |
| public static function read(string $data) : self{ | |
| return new self(array_values(unpack("J*", $data))); | |
| } | |
| public static function of(int $size) : self{ | |
| return new self(array_fill(0, ($size >> 4) | $size, 0)); |
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
| import numpy as np | |
| from numpy import exp, array, random, dot | |
| class NeuralNetwork(): | |
| def __init__(self): | |
| self.synaptic_weights = 2 * random.random((3, 1)) - 1 | |
| def __sigmoid(self, x): | |
| return 1 / (1 + exp(-x)) |
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
| <?php | |
| declare(strict_types=1); | |
| final class Matrix{ | |
| /** | |
| * Equivalent of numpy.random.random(size=(size_x, size_y)) | |
| * | |
| * @param int $size_x |
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
| use image::*; | |
| use image::imageops::FilterType; | |
| use std::result::Result; | |
| // Takes a byte array of skin data and returns the face layer encoded in a given | |
| // standard image format. The `width` and `height` here are the widths and heights | |
| // of the output image (not the input skin). | |
| fn skin_to_image_data(bytes: &Vec<u8>, width: u32, height: u32, format: ImageFormat) -> Result<Vec<u8>, &'static str>{ | |
| let blocks = skin_get_block_length(bytes.len())?; |
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
| import math | |
| ''' | |
| Divides the sample into two clusters - left and right, where the left cluster | |
| contains all values > mean(sample) and the right cluster contains all other | |
| values. | |
| The cluster with most number of values wins! Returns the winning cluster's mean. | |
| If the cluster's max deviation from mean (i.e., min(cluster) - mean(sample)) is |