diff --git a/Cargo.toml b/Cargo.toml index 0073463..5ba0704 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,5 @@ keywords = ["nn", "neural-network", "classifier", "backpropagation", "machine-learning"] [dependencies] -rand = "0.3.7" -rustc-serialize = "0.3.12" -time = "0.1.24" +rand = "0.3.14" +rustc-serialize = "0.3.19" diff --git a/src/lib.rs b/src/lib.rs index 45c2a77..4b0cee7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,14 +57,13 @@ extern crate rand; extern crate rustc_serialize; -extern crate time; use HaltCondition::{ Epochs, MSE, Timer }; use LearningMode::{ Incremental }; use std::iter::{Zip, Enumerate}; use std::slice; +use std::time::{ Duration, Instant }; use rustc_serialize::json; -use time::{ Duration, PreciseTime }; use rand::Rng; static DEFAULT_LEARNING_RATE: f64 = 0.3f64; @@ -299,7 +298,7 @@ impl NN { let mut prev_deltas = self.make_weights_tracker(0.0f64); let mut epochs = 0u32; let mut training_error_rate = 0f64; - let start_time = PreciseTime::now(); + let start_time = Instant::now(); loop { @@ -321,8 +320,7 @@ impl NN { if training_error_rate <= target_error { break } }, Timer(duration) => { - let now = PreciseTime::now(); - if start_time.to(now) >= duration { break } + if start_time.elapsed() >= duration { break } } } } diff --git a/tests/xor.rs b/tests/xor.rs index 4ef51eb..2e56a85 100644 --- a/tests/xor.rs +++ b/tests/xor.rs @@ -1,5 +1,4 @@ extern crate nn; -extern crate time; use nn::{NN, HaltCondition, LearningMode};