예제 #1
0
 async def accuracy(self, sources: Sources) -> Accuracy:
     """
     Evaluates the accuracy of our model after training using the input repos
     as test data.
     """
     if not os.path.isdir(self.model_dir_path):
         raise ModelNotTrained("Train model before assessing for accuracy.")
     input_fn = await self.accuracy_input_fn(sources)
     accuracy_score = self.model.evaluate(input_fn=input_fn)
     return Accuracy(accuracy_score["accuracy"])
예제 #2
0
파일: dnnr.py 프로젝트: abhishuraina/dffml
 async def accuracy(self, sources: Sources) -> Accuracy:
     """
     Evaluates the accuracy of our model after training using the input repos
     as test data.
     """
     if not os.path.isdir(self.model_dir_path):
         raise NotADirectoryError("Model not trained")
     input_fn = await self.evaluate_input_fn(
         sources, batch_size=20, shuffle=False, epochs=1
     )
     metrics = self.model.evaluate(input_fn=input_fn)
     return Accuracy(1 - metrics["loss"])  # 1 - mse
예제 #3
0
파일: dnn.py 프로젝트: sudharsana-kjl/dffml
 async def accuracy(self, sources: Sources, features: Features,
         classifications: List[Any]) -> Accuracy:
     '''
     Evaluates the accuracy of our model after training using the input repos
     as test data.
     '''
     if not os.path.isdir(self.model_dir_path(features)):
         raise NotADirectoryError('Model not trained')
     input_fn = await self.accuracy_input_fn(sources, features,
             classifications,
             batch_size=20, shuffle=False, num_epochs=1)
     accuracy_score = (await self.model(features, classifications))\
             .evaluate(input_fn=input_fn)
     return Accuracy(accuracy_score['accuracy'])
예제 #4
0
파일: slr.py 프로젝트: sauravsrijan/dffml
 async def accuracy(self, sources: Sources) -> Accuracy:
     if self.regression_line is None:
         raise ModelNotTrained("Train model before assessing for accuracy.")
     accuracy_value = self.regression_line[2]
     return Accuracy(accuracy_value)
예제 #5
0
파일: slr.py 프로젝트: arv1ndh/dffml
 async def accuracy(self, sources: Sources) -> Accuracy:
     if self.regression_line is None:
         raise ValueError("Model Not Trained")
     accuracy_value = self.regression_line[2]
     return Accuracy(accuracy_value)
예제 #6
0
 async def accuracy(self, sources: Sources) -> Accuracy:
     accuracy: int = 0
     async for repo in sources.repos():
         accuracy += int(repo.key)
     return Accuracy(accuracy)
예제 #7
0
 def test_str(self):
     self.assertEqual(str(Accuracy(0.04242)), "4.24")