📜 ⬆️ ⬇️

Logic function recovery

image


In this article you can find a ready-made implementation and description of an algorithm for the reconstruction of logical functions using the black box method. By a logical function, I mean a function that takes a set of Boolean values ​​as arguments and returns one, respectively. Example:
def customlogic(params): return params[0] and params[1] and not params[5] and params[11] or params[2] and not params[3] or params[0] and params[5] and not params[6] or params[7] and not params[8] 

At the end of the article the algorithm is checked on data obtained from the real world.

In my opinion, this task is closely related to neurophysiology and as you might have guessed, I was inspired by the work of neurons , so the analogies associated with the work and structure of this type of cells will be used. In particular, the desire for something came after reading an article about the structure and functioning of dendrites. Although I did not learn most of the material, but I made some analogies.

I think enough lyrics, let's get down to business.
Class source code and sample
 import random class LogicReconstructer: groups=[] threshold = 0.99 maxmem = 10 numparams = 0 def __init__(self,numparams,threshold = 0.99, totalmem = 10): self.numparams=numparams self.threshold=threshold self.maxmem=totalmem def getactive(self,params): if len(params)!=self.numparams: raise Exception("LogicReconstructer: numparams mismatch") active=[] for x in range(self.numparams): if params[x]: active.append(x) return active def extractgroups(self,params,result): active=self.getactive(params) exist = False ignore = False if result and active: ind=0 while ind<len(self.groups): if len(active)>len(self.groups[ind][0]) and self.issublist(self.groups[ind][0],active): ignore=True break elif len(active)==len(self.groups[ind][0]) and self.issublist(active,self.groups[ind][0]): exist=True break elif len(active)<len(self.groups[ind][0]) and self.issublist(active,self.groups[ind][0]): del self.groups[ind] ind-=1 ind+=1 if not exist and not ignore: self.groups.append([active,[0]*self.numparams,False]) def extractinhibitors(self,params,result): active=self.getactive(params) if result: count=0 for _,grp in enumerate(self.groups): if self.issublist(grp[0],active): count+=1 if count>1: return for _,grp in enumerate(self.groups): if not grp[2] and self.issublist(grp[0],active): neg=[] negvalue=False for y in range(self.numparams): if grp[1][y]<=-self.threshold: neg.append(y) negvalue|=params[y] elif grp[1][y]>=self.threshold: grp[2]=True for y in range(self.numparams): if params[y]: if y in neg or not negvalue: grp[1][y] = self.counting(grp[1][y],self.maxmem,result) def counting(self,prc,total,item): result=prc-prc/total if not item: result-=1/total else: result+=1/total return result def issublist(self,a,b): for ind,item in enumerate(a): if item not in b: return False return True def getsublist(self,a,b): result=[] for ind,item in enumerate(a): if item in b: result.append(item) return result def simulate(self,params): result=False for ind,item in enumerate(self.groups): if item[2]: locres=True for x in range(len(item[0])): locres&=params[item[0][x]] for x in range(len(item[1])): if item[1][x]<=-self.threshold: locres=locres&~params[x] result|=locres return result def getlogicfunc(self,guess=False): result="" for ind,item in enumerate(self.groups): if item[2] or guess: locres="" for x in range(len(item[0])): if x!=0: locres+=" and " locres+=str(item[0][x]) for x in range(len(item[1])): if item[1][x]<=-self.threshold: locres+=" and not "+str(x) if ind!=0: result+=" or " result+=locres return result def randparams(self): result = [] for x in range(self.numparams): result.append(random.choice([True, False])) return result def isready(self): result=bool(self.groups) for ind,item in enumerate(self.groups): result&=item[2] return result def getlogicstuct(self): result = [] for _,item in enumerate(self.groups): grp=[] if item[2]: for x in range(len(item[0])): grp.append([item[0][x],True]) for x in range(len(item[1])): if item[1][x]<=-self.threshold: grp.append([x,False]) if grp: result.append(grp) return result def simulatebystruct(self,params,grps): for _,item in enumerate(grps): locres=True for _,param in enumerate(item): if param[1]: locres&=params[param[0]] else: locres&=~params[param[0]] if not locres: break if locres: return True return False def customlogic(params): return params[0] and params[1] and not params[5]and params[11] or params[2] and not params[3] \ or params[0] and params[5] and not params[6] or params[7] and not params[8] def newme(): numparams = 12 neuron=LogicReconstructer(numparams) while not neuron.isready(): params=neuron.randparams() funcresult=customlogic(params) neuron.extractgroups(params,funcresult) neuron.extractinhibitors(params,funcresult) for x in range(1000): params=neuron.randparams() if neuron.simulate(params)!=customlogic(params): print("Simulate is wrong.") return print(neuron.getlogicfunc()) if __name__ == "__main__": newme() 


So, we have a set of input parameters, and some of them may not affect the performance of the implementation, so the first thing you need to understand what parameters are important. It is better to start with the collection of independent activation groups, in other words, if the result of the function is True, then we write the numbers of active parameters in the database, with some reservations, which you can see in the extractgroups method. Thus, we will find the parameters associated with the logical AND operator. This stage can be compared with growing dendrites.

Now let's move on to setting up synapses and, first of all, we need to distinguish inhibitory connections. Since groups are conditionally independent of inhibitory connections, it means that Bayes theorem can be used. In other words, if the activation group worked, then we calculate the effect of the other parameters on the result. If the parameter negatively affects the result, i.e. when activated, the result in most cases was False, then it is inhibiting (AND NOT). See the extractinhibitors method for details.
')
The operation of the algorithm is considered complete when all groups received confirmation that all inhibitory links were found. The confirmation is that the Bayesian probability of one of the parameters has stepped over the threshold .

But let us assume that we lack some important parameters with which the function works, how can we determine this? For example:
 params[0] and params[1] and not params[2] or params[3] and random.choice([True, False]) 

We know about 4 parameters, but do not take into account the fifth. In this particular case, the activation group, which consists only of parameter 3, does not cross the threshold. But if we still took him into account, he would be in the same group with the 3rd. As you understand, groups are separated by the logical OR operator.

But if you lack the whole group:
 params[0] and params[1] and not params[2] or random.choice([True, False]) and random.choice([True, False]) 
then the groups (sorry for the tautology) in the analysis are divided into single parameters and each parameter will become activation, which is a sign.

Try to play with customlogic in order to make sure that the algorithm works. For example, I noticed that with a large number of braking links in a group, it may not be defined.
Bonus C ++ Bed Sheet
 // neuro.cpp:      . // #include "stdafx.h" #include <vector> #include <map> #include <stdlib.h> #include <time.h> #include <iostream> using namespace std; class Bool { public: Bool(): m_value(){} Bool( bool value ) : m_value(value){} operator bool() const { return m_value;} bool* operator& () { return &m_value; } const bool * const operator& () const { return &m_value; } private: bool m_value; }; class neuron { public: double threshold; int synapticmem; int numparams; map<int,vector<char>> groups; map<int,vector<double>> bayesian; map<int,map<char,bool>> grouplogic; int maxid; neuron(int numparams, double threshold = 0.99, int synapticmem = 10) { this->numparams=numparams; this->threshold=threshold; this->synapticmem=synapticmem; maxid=0; srand ( time(NULL) ); } ~neuron() { } vector<char> getactive(vector<Bool>& params) { if (params.size()!=numparams) throw 1;// numparams mismatch vector<char> active; for (int i=0;i<this->numparams;i++) if (params[i]) active.push_back((char)i); return active; } void extractgroups(vector<Bool>& params, bool result) { vector<char> active= this->getactive(params); bool ignore = false; bool exist = false; if (result && active.size()>0) { map<int,vector<char>>::iterator i=this->groups.begin(); while (i!=this->groups.end()) { if (active.size()>i->second.size()&&this->issublist(i->second,active)) { ignore=true; break; } else if (active.size()==i->second.size()&&this->issublist(active,i->second)) { exist=true; break; } else if (active.size()<i->second.size()&&this->issublist(active,i->second)) { this->bayesian.erase(i->first); this->grouplogic.erase(i->first); i=this->groups.erase(i); } else i++; } if (!exist && !ignore) { this->groups[this->maxid]=active; this->bayesian[this->maxid]=*new vector<double>(numparams,0); this->maxid++; } } } template< class T > bool issublist(vector<T>& sublist, vector<T>& fulllist) { for (int i=0;i<sublist.size();i++) { bool match = false; for (int n=0;n<fulllist.size();n++) if (sublist[i]==fulllist[n]) { match=true; break; } if (!match) return false; } return true; } template<class InputIterator, class T> InputIterator find (InputIterator first, InputIterator last, const T& val) { while (first!=last) { if (*first==val) return first; ++first; } return last; } void extractinhibitors(vector<Bool>& params, bool result) { vector<char> active= this->getactive(params); if (result) { bool count = false; for (map<int,vector<char>>::iterator i=this->groups.begin();i!=this->groups.end();++i) if(this->issublist(i->second,active)) if (!count) count=true; else return; } for (map<int,vector<char>>::iterator i=this->groups.begin();i!=this->groups.end();++i) if (grouplogic.count(i->first)==0) if (this->issublist(i->second,active)) { vector<char> neg; bool negvalue = false; for (int n=0;n<this->numparams;n++) if (this->bayesian[i->first][n]<=-1*this->threshold) { neg.push_back((char)n); negvalue|=params[n]; } else if (this->bayesian[i->first][n]>=this->threshold) if (grouplogic.count(i->first)==0) this->build_grouplogic(i->first); for (int n=0;n<this->numparams;n++) if (params[n]) if (!negvalue || this->find(neg.begin(), neg.end(), n) != neg.end()) this->bayesian[i->first][n]=counting(this->bayesian[i->first][n],result); } } double counting(double prc, bool result) { double oneless = prc - prc/this->synapticmem; if (result) oneless+=1.0/this->synapticmem; else oneless-=1.0/this->synapticmem; return oneless; } void build_grouplogic(int indgroup) { for (int i=0;i<this->groups[indgroup].size();i++) this->grouplogic[indgroup][(char)groups[indgroup][i]]=true; for (int i=0;i<numparams;i++) if (this->bayesian[indgroup][i]<=-1*threshold) this->grouplogic[indgroup][(char)i]=false; } bool isready() { int count = 0; for (map<int,vector<char>>::iterator i=this->groups.begin();i!=this->groups.end();++i) if (grouplogic.count(i->first)!=0) count++; if (count==groups.size()&&groups.size()>0) return true; return false; } bool randomBool() { return rand() % 2 == 1; } void randparams(vector<Bool>& params) { for (int i=0;i<this->numparams;i++) params[i]=this->randomBool(); } string getfunction() { string result=""; bool maincount=false; for (map<int,map<char,bool>>::iterator i=this->grouplogic.begin();i!=this->grouplogic.end();++i) { if (maincount) result+=" or "; string locres=""; bool count = false; for (map<char,bool>::reverse_iterator n=i->second.rbegin();n!=i->second.rend();++n) { if (count) locres+=" and "; if (!n->second) locres+="not "; locres+=(char)(((int)'0')+(int)n->first); count=true; } result+=locres; maincount=true; } return result; } bool simulate(vector<Bool>& params) { bool result=false; for (map<int,map<char,bool>>::iterator i=this->grouplogic.begin();i!=this->grouplogic.end();++i) { bool locres=true; bool count = false; for (map<char,bool>::iterator n=i->second.begin();n!=i->second.end();++n) { if (n->second) locres&=params[(int)n->first]; else locres&=!params[(int)n->first]; } result|=locres; } return result; } }; bool customlogic(vector<Bool>& params) { return params[0] && params[1] && !params[2] || params[3] && !params[1] || params[5] && !params[0] && params[1]; } int _tmain(int argc, _TCHAR* argv[]) { int numparams = 6; clock_t start = clock() ; neuron* nine=new neuron(numparams); while (!nine->isready()) { vector<Bool> params(numparams, false); nine->randparams(params); bool result = customlogic(params); nine->extractgroups(params,result); nine->extractinhibitors(params,result); } clock_t end = clock(); double elapsed_time = (end-start)/(double)CLOCKS_PER_SEC; for (int i=0;i<1000;i++) { vector<Bool> params(numparams, false); nine->randparams(params); if (nine->simulate(params)!=customlogic(params)) { printf("Simulate is wrong"); return 0; } } printf("%s\n%.3f sec\n",nine->getfunction().c_str(),elapsed_time); getchar(); return 0; } 


Experiment


Of course it is good that the algorithm works, but can it cope with data from the real world? I decided to check it on a single data set taken from here . The task is to classify fake banknotes from the present in four parameters of type float. I must say I did not understand what they mean. But this is only on hand to the purity of the experiment, because the machine should be trained, not me.
That's what happened
 def getbinary(num,max,min =0 ): result=[] binnums=int(math.ceil(math.log(abs(min-max),2))) binstr=('{0:0'+str(binnums)+'b}').format(-min+num) for _,item in enumerate(binstr): if item=='1': result.append(True) else: result.append(False) return result def banknotes(): file = open('C:/bankdata.txt', 'r')# http://archive.ics.uci.edu/ml/datasets/banknote+authentication lines = file.readlines() file.close() data = [] for i in range(len(lines)): data.append(lines[i].strip().split(",")) lines.clear() numdata = [] paramsmax=[0,0,0,0] paramsmin=[0,0,0,0] for i in range(len(data)): tmp=[] for x in range(len(data[i])): if x!=4: tmp.append(int(round(float(data[i][x])))) paramsmax[x]=max(paramsmax[x],int(round(float(data[i][x])))) paramsmin[x]=min(paramsmin[x],int(round(float(data[i][x])))) else: if data[i][x]=='0': tmp.append(False) else: tmp.append(True) numdata.append(tmp) data.clear() bindata=[] for i in range(len(numdata)): tmp=[] for x in range(len(numdata[i])): if x!=4: tmp.extend(getbinary(numdata[i][x],paramsmax[x],paramsmin[x])) else: tmp.extend([numdata[i][x]]) bindata.append(tmp) numdata.clear() neuron = LogicReconstructer(len(bindata[0])-1,totalmem=7, threshold=0.98) for _,item in enumerate(bindata): neuron.extractgroups(item[:-1],item[-1:][0]) ready=False while not neuron.isready(): rnd=random.randint(0,len(bindata)-1) neuron.extractinhibitors(bindata[rnd][:-1],bindata[rnd][-1:][0]) logicstruct=neuron.getlogicstuct() print(logicstruct) falsepositive = 0 falsenegative = 0 for _,item in enumerate(bindata): res = neuron.simulatebystruct(item[:-1],logicstruct) if res!=item[-1:][0]: if res: falsepositive+=1 else: falsenegative+=1 print(falsenegative/len(bindata),falsepositive/len(bindata)) 


Since the algorithm only accepts binary data, I had to round numbers to integers and convert them to binary form using the getbinary function. After training, I got this structure consisting of 134 logical groups:
logicstruct
  logicstr="[[[2, True], [3, True], [6, True], [7, True], [10, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [3, True], [4, True], [8, True], [12, True], [15, True], [16, True], [17, True]], [[1, True], [3, True], [5, True], [10, True], [12, True], [14, True], [16, True], [6, False], [7, False], [8, False], [11, False]], [[1, True], [2, True], [5, True], [6, True], [7, True], [11, True], [13, True], [14, True], [16, True], [10, False]], [[1, True], [2, True], [5, True], [6, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[2, True], [3, True], [8, True], [9, True], [12, True], [15, True], [16, True]], [[1, True], [2, True], [3, True], [4, True], [8, True], [15, True], [17, True], [6, False], [7, False], [11, False]], [[1, True], [4, True], [7, True], [8, True], [11, True], [15, True], [2, False], [6, False]], [[1, True], [6, True], [10, True], [11, True], [12, True], [15, True], [16, True], [17, True]], [[0, True], [5, True], [6, True], [7, True], [8, True], [12, True], [14, True], [17, True], [10, False], [11, False], [13, False]], [[0, True], [4, True], [7, True], [15, True], [17, True], [6, False], [16, False]], [[1, True], [3, True], [5, True], [10, True], [12, True], [14, True], [17, True], [2, False], [6, False], [7, False]], [[0, True], [5, True], [6, True], [7, True], [12, True], [13, True], [14, True], [16, True], [2, False], [11, False]], [[0, True], [4, True], [7, True], [8, True], [16, True], [17, True], [6, False], [15, False]], [[1, True], [4, True], [8, True], [11, True], [13, True], [14, True], [2, False]], [[0, True], [4, True], [12, True], [14, True], [17, True], [6, False], [11, False], [13, False]], [[2, True], [3, True], [4, True], [8, True], [11, True], [15, True], [17, True], [1, False], [6, False], [7, False]], [[1, True], [3, True], [5, True], [6, True], [7, True], [11, True], [14, True], [2, False], [10, False], [12, False]], [[1, True], [2, True], [4, True], [12, True], [14, True], [11, False]], [[1, True], [6, True], [7, True], [8, True], [9, True], [14, True]], [[2, True], [5, True], [9, True], [14, True]], [[1, True], [4, True], [7, True], [11, True], [13, True], [14, True], [2, False], [3, False], [8, False], [12, False], [17, False]], [[1, True], [3, True], [5, True], [8, True], [10, True], [11, True], [14, True], [17, True], [6, False]], [[2, True], [3, True], [6, True], [7, True], [9, True], [13, True], [14, True]], [[1, True], [5, True], [6, True], [8, True], [11, True], [12, True], [13, True], [14, True], [16, True], [0, False], [7, False]], [[2, True], [3, True], [7, True], [9, True], [11, True], [14, True]], [[1, True], [5, True], [6, True], [7, True], [11, True], [12, True], [14, True], [16, True], [0, False], [8, False]], [[1, True], [3, True], [4, True], [8, True], [12, True], [13, True], [15, True], [16, True], [2, False], [5, False], [6, False], [11, False]], [[1, True], [6, True], [8, True], [10, True], [11, True], [12, True], [14, True]], [[1, True], [2, True], [4, True], [8, True], [13, True], [15, True], [16, True], [6, False]], [[1, True], [2, True], [5, True], [6, True], [10, True], [14, True], [16, True], [11, False], [13, False]], [[2, True], [3, True], [4, True], [7, True], [8, True], [11, True], [15, True], [1, False], [6, False], [17, False]], [[1, True], [6, True], [10, True], [11, True], [13, True], [15, True], [16, True], [17, True]], [[1, True], [2, True], [5, True], [7, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[2, True], [4, True], [6, True], [8, True], [11, True], [13, True], [16, True], [0, False], [15, False]], [[1, True], [5, True], [6, True], [7, True], [10, True], [14, True], [17, True], [2, False], [8, False], [11, False], [12, False]], [[1, True], [5, True], [10, True], [12, True], [13, True], [14, True], [16, True]], [[0, True], [4, True], [7, True], [15, True], [16, True], [6, False], [17, False]], [[1, True], [2, True], [3, True], [4, True], [7, True], [8, True], [16, True], [17, True], [6, False]], [[1, True], [2, True], [5, True], [6, True], [11, True], [14, True], [17, True], [10, False], [12, False]], [[1, True], [2, True], [4, True], [8, True], [12, True], [15, True], [16, True]], [[1, True], [4, True], [11, True], [13, True], [15, True], [16, True], [17, True], [5, False], [6, False], [7, False], [8, False]], [[2, True], [3, True], [5, True], [10, True], [11, True], [12, True], [13, True], [14, True]], [[2, True], [5, True], [8, True], [10, True], [11, True], [12, True], [13, True], [14, True]], [[1, True], [2, True], [5, True], [6, True], [7, True], [8, True], [11, True], [14, True], [3, False], [10, False], [12, False], [16, False], [17, False]], [[1, True], [7, True], [9, True], [13, True], [15, True], [16, True]], [[1, True], [2, True], [5, True], [10, True], [13, True], [14, True], [17, True], [3, False], [6, False], [11, False]], [[0, True], [5, True], [6, True], [7, True], [8, True], [11, True], [14, True], [17, True], [12, False], [16, False]], [[1, True], [3, True], [6, True], [7, True], [10, True], [11, True], [14, True], [5, False]], [[0, True], [5, True], [7, True], [8, True], [11, True], [12, True], [13, True], [14, True], [16, True], [2, False], [6, False]], [[2, True], [3, True], [4, True], [6, True], [11, True], [13, True], [16, True], [17, True], [1, False], [7, False], [8, False], [15, False]], [[1, True], [5, True], [6, True], [8, True], [10, True], [14, True], [17, True], [11, False]], [[1, True], [2, True], [5, True], [8, True], [10, True], [14, True], [17, True], [3, False], [6, False], [11, False]], [[2, True], [4, True], [6, True], [7, True], [11, True], [13, True], [15, True], [1, False], [16, False], [17, False]], [[1, True], [4, True], [11, True], [12, True], [14, True], [17, True], [2, False], [3, False], [13, False]], [[1, True], [2, True], [3, True], [5, True], [6, True], [7, True], [8, True], [12, True], [13, True], [14, True]], [[1, True], [2, True], [5, True], [6, True], [10, True], [12, True], [14, True], [17, True], [3, False], [7, False]], [[1, True], [6, True], [7, True], [9, True], [13, True], [14, True]], [[1, True], [9, True], [11, True], [12, True], [13, True], [15, True], [16, True], [17, True]], [[1, True], [7, True], [9, True], [12, True], [13, True], [14, True]], [[1, True], [2, True], [5, True], [10, True], [12, True], [14, True], [16, True]], [[3, True], [4, True], [6, True], [11, True], [12, True], [16, True], [0, False]], [[1, True], [8, True], [9, True], [12, True], [15, True], [16, True]], [[2, True], [4, True], [6, True], [7, True], [11, True], [13, True], [17, True], [15, False]], [[1, True], [2, True], [6, True], [7, True], [8, True], [10, True], [12, True], [14, True], [17, True]], [[2, True], [3, True], [4, True], [8, True], [11, True], [13, True], [14, True], [1, False], [12, False]], [[0, True], [4, True], [8, True], [13, True], [14, True], [2, False], [11, False], [12, False], [16, False], [17, False]], [[2, True], [3, True], [4, True], [8, True], [11, True], [15, True], [16, True], [1, False], [6, False], [7, False], [17, False]], [[2, True], [4, True], [8, True], [11, True], [12, True], [14, True], [0, False], [3, False]], [[1, True], [5, True], [6, True], [7, True], [11, True], [13, True], [14, True], [17, True], [0, False]], [[2, True], [3, True], [6, True], [8, True], [9, True], [13, True], [14, True]], [[1, True], [5, True], [6, True], [8, True], [10, True], [14, True], [16, True], [11, False]], [[1, True], [2, True], [6, True], [7, True], [10, True], [11, True], [14, True], [17, True]], [[1, True], [3, True], [6, True], [10, True], [11, True], [13, True], [14, True], [5, False]], [[1, True], [2, True], [3, True], [5, True], [7, True], [8, True], [11, True], [12, True], [14, True], [16, True]], [[2, True], [3, True], [4, True], [6, True], [11, True], [12, True], [15, True], [1, False], [7, False]], [[1, True], [2, True], [5, True], [10, True], [13, True], [14, True], [16, True], [6, False], [11, False]], [[1, True], [2, True], [3, True], [5, True], [6, True], [8, True], [11, True], [14, True], [16, True]], [[1, True], [2, True], [5, True], [6, True], [7, True], [8, True], [12, True], [13, True], [14, True], [17, True]], [[1, True], [3, True], [5, True], [6, True], [10, True], [13, True], [14, True], [17, True], [2, False], [11, False]], [[2, True], [3, True], [9, True], [11, True], [12, True], [13, True], [15, True], [16, True]], [[2, True], [3, True], [6, True], [7, True], [8, True], [9, True], [14, True], [17, True]], [[1, True], [8, True], [9, True], [11, True], [13, True], [14, True]], [[1, True], [2, True], [6, True], [7, True], [10, True], [11, True], [14, True], [16, True], [5, False], [13, False]], [[1, True], [3, True], [6, True], [10, True], [11, True], [12, True], [14, True], [17, True]], [[1, True], [2, True], [7, True], [8, True], [10, True], [11, True], [12, True], [13, True], [14, True]], [[0, True], [5, True], [6, True], [7, True], [11, True], [14, True], [16, True], [8, False], [12, False], [13, False]], [[1, True], [4, True], [7, True], [11, True], [15, True], [17, True], [2, False], [6, False]], [[0, True], [5, True], [7, True], [11, True], [12, True], [13, True], [14, True], [16, True], [17, True], [2, False], [6, False]], [[3, True], [4, True], [6, True], [7, True], [11, True], [13, True], [15, True], [0, False], [17, False]], [[1, True], [3, True], [5, True], [6, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [3, True], [5, True], [10, True], [11, True], [13, True], [14, True], [17, True], [2, False], [6, False]], [[1, True], [6, True], [7, True], [10, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [3, True], [4, True], [8, True], [12, True], [13, True], [15, True], [17, True], [2, False], [6, False], [7, False], [11, False]], [[4, True], [6, True], [8, True], [11, True], [12, True], [17, True], [0, False], [15, False]], [[1, True], [7, True], [8, True], [10, True], [11, True], [12, True], [15, True], [16, True], [17, True]], [[1, True], [5, True], [10, True], [12, True], [13, True], [14, True], [17, True]], [[1, True], [3, True], [6, True], [7, True], [8, True], [10, True], [12, True], [14, True]], [[0, True], [5, True], [6, True], [7, True], [12, True], [13, True], [14, True], [17, True], [3, False], [8, False], [11, False]], [[3, True], [4, True], [6, True], [7, True], [8, True], [11, True], [13, True], [16, True], [15, False]], [[2, True], [3, True], [4, True], [11, True], [12, True], [14, True], [0, False], [1, False], [8, False]], [[4, True], [6, True], [7, True], [8, True], [11, True], [13, True], [15, True], [1, False], [2, False], [3, False]], [[1, True], [2, True], [4, True], [11, True], [14, True], [3, False], [6, False], [10, False]], [[2, True], [3, True], [6, True], [7, True], [9, True], [12, True], [15, True], [16, True], [17, True]], [[1, True], [3, True], [4, True], [7, True], [11, True], [15, True], [16, True], [2, False], [6, False]], [[2, True], [3, True], [8, True], [9, True], [11, True], [13, True], [15, True], [16, True], [17, True]], [[2, True], [3, True], [6, True], [7, True], [10, True], [11, True], [12, True], [13, True], [14, True], [17, True]], [[1, True], [3, True], [4, True], [7, True], [12, True], [13, True], [15, True], [17, True], [6, False]], [[1, True], [4, True], [8, True], [11, True], [15, True], [16, True], [2, False], [13, False]], [[1, True], [6, True], [7, True], [8, True], [10, True], [12, True], [13, True], [14, True]], [[1, True], [2, True], [5, True], [7, True], [11, True], [12, True], [13, True], [14, True], [17, True]], [[2, True], [4, True], [6, True], [8, True], [11, True], [13, True], [17, True], [0, False], [15, False]], [[1, True], [2, True], [3, True], [5, True], [6, True], [7, True], [12, True], [13, True], [14, True], [17, True]], [[4, True], [5, True], [11, True], [13, True], [16, True], [1, False], [15, False]], [[1, True], [2, True], [4, True], [8, True], [12, True], [15, True], [17, True], [11, False]], [[2, True], [3, True], [4, True], [7, True], [11, True], [15, True], [17, True], [1, False], [6, False]], [[2, True], [4, True], [7, True], [11, True], [12, True], [14, True], [0, False], [3, False]], [[2, True], [3, True], [5, True], [6, True], [7, True], [11, True], [12, True], [14, True], [17, True], [0, False], [8, False], [16, False]], [[1, True], [3, True], [4, True], [11, True], [14, True], [2, False], [6, False], [16, False]], [[2, True], [3, True], [6, True], [7, True], [9, True], [13, True], [15, True], [16, True], [17, True]], [[2, True], [8, True], [9, True], [11, True], [14, True]], [[1, True], [2, True], [3, True], [4, True], [7, True], [15, True], [17, True], [6, False], [11, False]], [[1, True], [6, True], [7, True], [8, True], [10, True], [11, True], [14, True], [5, False]], [[1, True], [2, True], [3, True], [5, True], [6, True], [7, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [5, True], [6, True], [11, True], [12, True], [14, True], [17, True], [2, False]], [[2, True], [3, True], [4, True], [11, True], [13, True], [15, True], [16, True], [1, False]], [[2, True], [8, True], [9, True], [11, True], [12, True], [15, True], [16, True]], [[0, True], [5, True], [6, True], [7, True], [11, True], [13, True], [14, True], [17, True], [1, False], [2, False], [8, False], [12, False]], [[1, True], [2, True], [6, True], [10, True], [11, True], [12, True], [14, True], [17, True]], [[0, True], [4, True], [8, True], [13, True], [15, True], [17, True], [2, False], [3, False], [5, False], [6, False]], [[1, True], [3, True], [7, True], [8, True], [10, True], [11, True], [12, True], [14, True], [5, False], [6, False], [16, False]], [[1, True], [2, True], [3, True], [5, True], [8, True], [11, True], [12, True], [13, True], [14, True], [16, True]], [[1, True], [2, True], [3, True], [5, True], [6, True], [11, True], [13, True], [14, True], [16, True], [10, False]], [[1, True], [4, True], [8, True], [11, True], [15, True], [17, True], [2, False], [12, False]]]" logicstruct=literal_eval(logicstr) 


which gives 2.8% false negative and 0.6% false positive responses. These 134 groups summarized about 700 positive examples. There were a total of 1,372 entries. Each launch can generate a new structure. I also ask you to note that I did not divide the data into training and verification samples and criticism in the plan: “Yes, the algorithm simply remembered everything and will be covered with new data” is quite appropriate.

image

Source: https://habr.com/ru/post/208240/


All Articles