<commit_before>package forecasting

import (
	"github.com/fxsjy/RF.go/RF"
	"io"
	"../data"
)

func buildData (data []Record) (inputs [][]interface{} , targets []float64){
	for i := 0; i<len(data); i++ {
		if data[i].null {
			break
		}
		row := make([]interface{},5)
		row[0]=data[i].Time
		row[1]=data[i].Radiation
		row[2]=data[i].Humidity
		row[3]=data[i].Temperature
		row[4]=data[i].Wind
		inputs = append(inputs,row)
		targets = append(targets,data[i].Power)
	}
	return
}

func learnCSV (file io.Reader, channel chan data.CSVRequest) *RF.Forest {
	ret := make(chan CVSData, 1)
	request := new(data.CSVRequest)
	request.Return = ret
	request.Request = file
	channel <- request
	var resp CSVData
	for {
		if resp <-ret {
			break
		}
	}
	inputs, targets := buildData(resp.Data)
	forest := RF.BuildForrest(inputs, targets, len(targets), len(inputs),1)
	return forest
}
	
<commit_msg>well, at least data compiles for now<commit_after>package forecasting

import (
	"github.com/fxsjy/RF.go/RF"
	"io"
	"../data"
)

func buildData (data []data.Record) (inputs [][]interface{} , targets []float64){
	for i := 0; i<len(data); i++ {
		if data[i].null {
			break
		}
		row := make([]interface{},5)
		row[0]=data[i].Time
		row[1]=data[i].Radiation
		row[2]=data[i].Humidity
		row[3]=data[i].Temperature
		row[4]=data[i].Wind
		inputs = append(inputs,row)
		targets = append(targets,data[i].Power)
	}
	return
}

func learnCSV (file io.Reader, channel chan *data.CSVRequest) *RF.Forest {
	ret := make(chan *CVSData, 1)
	request := new(data.CSVRequest)
	request.Return = ret
	request.Request = file
	channel <- request
	var resp CSVData
	for {
		if resp <-ret {
			break
		}
	}
	inputs, targets := buildData(resp.Data)
	forest := RF.BuildForrest(inputs, targets, len(targets), len(inputs),1)
	return forest
}
	

{'fraction_non_alphanumeric': 0.1709211986681465, 'fraction_numerical': 0.01220865704772475, 'mean_word_length': 4.064606741573034, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '4091252', 'n_tokens_mistral': 753, 'n_tokens_neox': 691, 'n_words': 150}