-
-
Save mdfarragher/02300fdbbcf2c84b4ddde895fc6d3b66 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Linq; | |
using CNTK; | |
using CNTKUtil; | |
using XPlot.Plotly; | |
namespace MovieSentiment | |
{ | |
/// <summary> | |
/// The main program class. | |
/// </summary> | |
public class Program | |
{ | |
// filenames for data set | |
private static string dataPath = Path.Combine(Environment.CurrentDirectory, "IMDB Dataset.csv"); | |
/// <summary> | |
/// The main program entry point. | |
/// </summary> | |
/// <param name="args">The command line parameters.</param> | |
static void Main(string[] args) | |
{ | |
// check the compute device | |
Console.WriteLine("Checking compute device..."); | |
Console.WriteLine($" Using: {NetUtil.CurrentDevice.AsString()}"); | |
// unpack archive | |
if (!File.Exists("x_train_imdb.bin")) | |
{ | |
ZipFile.ExtractToDirectory("imdb_data.zip", "."); | |
} | |
// load training and test data | |
Console.WriteLine("Loading data files..."); | |
var sequenceLength = 500; | |
var training_data = DataUtil.LoadBinary<float>("x_train_imdb.bin", 25000, sequenceLength); | |
var training_labels = DataUtil.LoadBinary<float>("y_train_imdb.bin", 25000); | |
var testing_data = DataUtil.LoadBinary<float>("x_test_imdb.bin", 25000, sequenceLength); | |
var testing_labels = DataUtil.LoadBinary<float>("y_test_imdb.bin", 25000); | |
// the rest of the code goes here... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment