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
// create a prediction engine for one single prediction | |
var predictionFunction = model.CreatePredictionEngine<TaxiTrip, TaxiTripFarePrediction>(mlContext); | |
// prep a single taxi trip | |
var taxiTripSample = new TaxiTrip() | |
{ | |
VendorId = "VTS", | |
RateCode = "1", | |
PassengerCount = 1, | |
TripDistance = 3.75f, |
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
// get a set of predictions | |
Console.Write("Evaluating the model...."); | |
var predictions = model.Transform(partitions.TestSet); | |
// get regression metrics to score the model | |
var metrics = mlContext.Regression.Evaluate(predictions, "Label", "Score"); | |
Console.WriteLine("done"); | |
// show the metrics | |
Console.WriteLine(); |
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
// set up a learning pipeline | |
var pipeline = mlContext.Transforms.CopyColumns( | |
inputColumnName:"FareAmount", | |
outputColumnName:"Label") | |
// one-hot encode all text features | |
.Append(mlContext.Transforms.Categorical.OneHotEncoding("VendorId")) | |
.Append(mlContext.Transforms.Categorical.OneHotEncoding("RateCode")) | |
.Append(mlContext.Transforms.Categorical.OneHotEncoding("PaymentType")) |
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
/// <summary> | |
/// The program class. | |
/// </summary> | |
class Program | |
{ | |
// file paths to data files | |
static readonly string dataPath = Path.Combine(Environment.CurrentDirectory, "yellow_tripdata_2018-12.csv"); | |
/// <summary> | |
/// The main application entry point. |
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
/// <summary> | |
/// The TaxiTrip class represents a single taxi trip. | |
/// </summary> | |
public class TaxiTrip | |
{ | |
[LoadColumn(0)] public string VendorId; | |
[LoadColumn(5)] public string RateCode; | |
[LoadColumn(3)] public float PassengerCount; | |
[LoadColumn(4)] public float TripDistance; | |
[LoadColumn(9)] public string PaymentType; |
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
""" | |
https://gist.github.com/Azadehkhojandi/50eaae4cf20b21faef186f2c8ee97873 | |
""" | |
import hmac | |
import hashlib | |
import binascii | |
def create_sha256_signature(key, message): |
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
public static string CreateSHA256Signature(string key, string message) | |
{ | |
// Hex Decode the Secure Secret for use in using the HMACSHA256 hasher | |
// hex decoding eliminates this source of error as it is independent of the character encoding | |
// hex decoding is precise in converting to a byte array and is the preferred form for representing binary values as hex strings. | |
var convertedHash = new byte[key.Length / 2]; | |
for (var i = 0; i < key.Length / 2; i++) | |
{ | |
convertedHash[i] = (byte)int.Parse(key.Substring(i * 2, 2), System.Globalization.NumberStyles.HexNumber); | |
} |
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
Run this command to install MG-CLI: | |
sudo apt-get update && wget https://minergate.com/download/deb-cli -O minergate-cli.deb && sudo dpkg -i minergate-cli.deb | |
to start miner (4 cores for BCN) use this command: | |
minergate-cli -user <YOUR@EMAIL.KAPPA> -bcn 4 | |
Feel free to send some of your earnings to me: | |
BTC (Don't attempt to send other coins to this address!): 17f77AYHsQbdsB1Q6BbqPahJ8ZrjFLYH2j |
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
// fade out | |
function fade(el) { | |
var op = 1; | |
var timer = setInterval(function () { | |
if (op <= 0.1){ | |
clearInterval(timer); | |
el.style.display = 'none'; | |
} | |
el.style.opacity = op; |