<commit_before>require 'minitest/autorun'
require 'csv'
require_relative '../init.rb'


describe 'Bayesian Network' do
  it 'should create network and return probability' do
    net       = BayesianNetwork::Net.new("Grass Wetness Belief Net")
    cloudy    = BayesianNetworkbn::Variable.new(net, :cloudy, [0.5, 0.5])
    sprinkler = BayesianNetwork::Variable.new(net, :sprinkler, [0.1, 0.9, 0.5, 0.5])
    rain      = BayesianNetwork::Variable.new(net, :rain, [0.8, 0.2, 0.2, 0.8])
    grass_wet = BayesianNetwork::Variable.new(net, :grass_wet, [0.99, 0.01, 0.9, 0.1, 0.9, 0.1, 0.0, 1.0])
    cloudy.add_child(sprinkler)        # also creates parent relationship
    cloudy.add_child(rain)
    sprinkler.add_child(grass_wet)
    rain.add_child(grass_wet)
    evidence = {:cloudy => :false, :rain => :true}
    net.set_evidence(evidence)
    puts net.query_variable(:grass_wet)
  end

  
end<commit_msg>fixed test for belif network<commit_after>require 'minitest/autorun'
require 'csv'
require_relative '../init.rb'


describe 'Bayesian Network' do
  it 'should create network and return probability' do
    net       = BayesianNetwork::Net.new("Grass Wetness Belief Net")
    cloudy    = BayesianNetwork::Variable.new(net, :cloudy, [0.5, 0.5])
    sprinkler = BayesianNetwork::Variable.new(net, :sprinkler, [0.1, 0.9, 0.5, 0.5])
    rain      = BayesianNetwork::Variable.new(net, :rain, [0.8, 0.2, 0.2, 0.8])
    grass_wet = BayesianNetwork::Variable.new(net, :grass_wet, [0.99, 0.01, 0.9, 0.1, 0.9, 0.1, 0.0, 1.0])
    cloudy.add_child(sprinkler)        # also creates parent relationship
    cloudy.add_child(rain)
    sprinkler.add_child(grass_wet)
    rain.add_child(grass_wet)
    evidence = {:cloudy => :false, :rain => :true}
    net.set_evidence(evidence)
    puts net.query_variable(:grass_wet)
  end

  it 'should create network and return probability' do
    net       = BayesianNetwork::Net.new("")
    cloudy    = BayesianNetwork::Variable.new(net, :cloudy, [0.5, 0.5])
    sprinkler = BayesianNetwork::Variable.new(net, :sprinkler, [0.1, 0.9, 0.5, 0.5])
    rain      = BayesianNetwork::Variable.new(net, :rain, [0.8, 0.2, 0.2, 0.8])
    grass_wet = BayesianNetwork::Variable.new(net, :grass_wet, [0.99, 0.01, 0.9, 0.1, 0.9, 0.1, 0.0, 1.0])
    cloudy.add_child(sprinkler)        # also creates parent relationship
    cloudy.add_child(rain)
    sprinkler.add_child(grass_wet)
    rain.add_child(grass_wet)
    evidence = {:cloudy => :false, :rain => :true}
    net.set_evidence(evidence)
    puts net.query_variable(:grass_wet)
  end


end
{'fraction_non_alphanumeric': 0.15113547376664058, 'fraction_numerical': 0.04463586530931871, 'mean_word_length': 3.5953237410071943, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5922163', 'n_tokens_mistral': 1053, 'n_tokens_neox': 955, 'n_words': 202}