Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gyrdym committed May 6, 2020
1 parent 53d734a commit 26b5c38
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/src/tree_trainer/decision_tree_trainer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class DecisionTreeTrainer implements TreeTrainer {
Matrix samples,
num splittingValue,
int splittingIdx,
TreeNodeSplittingPredicateType splittingClauseType,
TreeNodeSplittingPredicateType splittingPredicateType,
Iterable<int> featuresColumnIdxs,
int level,
) {
if (_leafDetector.isLeaf(samples, _targetIdx, featuresColumnIdxs, level)) {
final label = _leafLabelFactory.create(samples, _targetIdx);
return TreeNode(
splittingClauseType,
splittingPredicateType,
splittingValue,
splittingIdx,
null,
Expand Down Expand Up @@ -78,7 +78,7 @@ class DecisionTreeTrainer implements TreeTrainer {
});

return TreeNode(
splittingClauseType,
splittingPredicateType,
splittingValue,
splittingIdx,
childNodes.toList(growable: false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class NominalTreeSplitterImpl implements NominalTreeSplitter {

Map.fromEntries(uniqueValues.map((value) {
final splittingClauseType = TreeNodeSplittingPredicateType.equalTo;
final splittingClause = getTreeNodeSplittingPredicateByType(
final splittingPredicate = getTreeNodeSplittingPredicateByType(
splittingClauseType);

final foundRows = samples
.rows
.where((row) => splittingClause(row, splittingIdx, value))
.where((row) => splittingPredicate(row, splittingIdx, value))
.toList(growable: false);

final node = TreeNode(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:ml_algo/src/tree_trainer/tree_node/tree_node.dart';

// TODO: find a way to use Iterable here instead of List (Iterable is not accepted by json serializable)
List<TreeNode> fromTreeNodesJson(Iterable collection) =>
collection
?.map(
Expand Down

0 comments on commit 26b5c38

Please sign in to comment.