Package: bireyselvalue
About the PackageAuthor's WordsWelcome tothe first Edition of theBireyselvalueAlgorithmofficial documentation. I am Dr. Deniz Dahman
the creator of the BireyselValue algorithm and the author of this package. In the following section you
will have a brief introduction on the principal idea of the BireyselValue algorithm.
In addition, a reference to the academic publication on the method. Before going ahead, I would like
to let you know that I have done this work as an independent scientist without any fund or similar capacity.
I am dedicated to proceeding and seek further improvement on the proposed method at all costs.
To this end if you wish to contribute in any way to this work, please find further details  in the contributing section.ContributingIf you wish to contribute to the creator of this method and the author, you may want to check possible ways on:patreonYouTubeIf you prefer any other way of contribution, please feel free to contact me directly. Thank youIntroductionThe BireyselValue AlgorithmClassification is something that exists in nature in a very mysterious way. In fact, I do believe that
our evolution in some way is related to theprinciple of classification. See, we like to classify things,
sometimes, we use a set ofadjectivese.g. the good one, the bad one, the far one the close one, etc.
Other times, we intend to use a set ofnouns, i.e.classifying by group names, e.g. the A group,
the South way, etc. That’s weird itself, as I am trying to introduce the definition of classification,
I did classify two ways already, as ifan infinite circle. Anyway, see here are two ways we classify things,
one I called the subjective way of classification usingadjectives, the second is objective way of classification usingnouns. These are how society tends to use the principle of classifications using the human language.That has been said, there is this magical tool that uses its own independent language, tends todissolvethis
line of difference betweensubjectivism, andobjectivism, and that is the use ofmathematics.
In mathematics, we tend to convert everything into set of numbers, yet to understand thebehaviorand thestructureof those numbers, and finally, we just see how things are grouped.To this end, I introducea new method of classificationthat isBireyselValue Algorithm.Bireyselin Turkish language it means(individual, personal). The method is structured based onthree blocks,the building block,the training block,and the prediction block.It basically, relays on4 characteristics, I call themthe personal profile. To learn the details of this method please check outthe official academic publicationfound in the reference.bireyselvalue package __version__1.0As scientists we must beskeptical. Not in a destructive way but in a constructive way, so to speak.
So, the best approach to be a constructive scientist is to build your research first in anabstract waythen in aconcrete way. To this end, I have proposed the method and its structure, yet, I had to introduce
aconcretemeasure on that proposal, and that isthe purpose of this package. This package is thefirst editionof the BireyselValue Algorithm, official released namebireyselvalue. This package will serve as atestingtool
on the proposed method, of its first edition. In other words,not yet for a production capacity, but rather forresearch and developmentpurposes ONLY. The essential finding on accuracy of prediction isvery much promising.
In future releases, enhancement of extra features will be added, and yet to be tested.
To this end, you may feel free to follow the set-up instructions as the following sections suggest.Installation[!TIP]
The first edition bireyselvalue is tested on severalproblematicdatasets. What I mean by problematic is
a dataset withextreme overlapping behaviorsacross classes and hasinsufficientclassificationaccuracyusing other classification methods. Those sets have various dimensions that go as high as13000 observationsand36 variables. I employed the method using a verybasic machine capacitythat today’s industry can offer.
To conclude, youdon’t need any advanced hardware capacitybut only basic ones.
In addition, you make sure you have Python 3 or above version.Install bireyselvalueto install the package all what you have to do:pip install bireyselvalueYou should then be able to use the package. You may want to confirm the installationpip show bireyselvalueThe result then shall be as:Name: bireyselvalue
Version: 1.0.0
Summary: TEST ON V.1 of THE BireyselValue Algorithm FOR CLASSIFICATION PROBLEMS
Home-page: https://github.com/dahmansphi/bireyselvalue_v1
Author: Dr. Deniz Dahman's
Author-email: dahmansphi@gmail.comEmploy the bireyselvalue -Conditions[!IMPORTANT]
It’s mandatory, to use the first edition of bireyselvalue, to make sure the training dataset meets the conditions:Number of observations > 40 per classNumber of variables >= 2Number of classes >= 2.Once these conditions are met then you may employ the bireyselvalue. Anyway, the package has a condition built in to make sure those conditions are met.As I have mentioned in the introduction, there arethree blocksfor the bireyselvalue
to makethe final prediction. Essentially, we need atraining datasetthat the package willbuild,
thentrain. Eventually, we call on thepredict_testto test the result.
Since this is thefirst editionas a testing block for the method, you will see that
the onlyactivefunction for prediction ispredict_test. To this end you need to make sure:Thetrainingdataset isseparatedfrom the class vector. i.e. you should have thedsand thecls. Where the shape ofdsshould bem x nand theclsshould bem x 1Thetestdataset isseparatedfrom the class vector. i.e. you should have theds_testand thecls_test. Where the shape ofds_testshould bem x nand thecls_testshould bem x 1.both training and testing dataset shall be ofnumpytype dataset.Detour in the bireyselvalue package- Build-inOnce your installation is done, and you have met all the conditions, then you may want to check
the build-in functions of the bireyselvalue and understand each.Essentially, if you create an instance from the bireyselvalue as so:from bireyselvalue.bireyselvalue import BireyselValue
inst = BireyselValue()now thisinstinstance offers you access to those build in functions that you need.
this is a screenshot:Once you have bireyselvalue instance, here are the details of the right sequence to employ the bireyselvalue:first step:the train block. you must and option:MUSTcall theinput_feature()which expect two args thedsand theclsvector classOPTIONyou can callreport_input()which will give a comrehensive report on the ds and visual graph on
the class overlapping status, see the screenshots belowMUSTyou callbuild()this main function expects one argument that is the radius which must
be within range
0.1 <= r <= 0.99. the function of the radius can be understood from the acadamic publication of
the bireyselvalue algorithm refere to the referenceOPTIONyou may calbuild_report()this function expect arg as number that will display a sample of
the neighbors list. once again you may want to the check the publication paper to understand the ns.MUSTyou caltrain()this is the third main function that will do the train processOPTIONyou may callmodel_summary()this function will give you a detail summary on the modelsecond step:once you have your model and all the report and summary details then you are ready. so you have to call then
thesave_model()which expects of course the path to where to savethird step:of course it's time now to load that saved model which hass the 5 parameters the bireyselvalue relays on.
we first of course create a new instance from theBireyselValuethen call theload_model(). you have
an option to view the details on that loaded model as well calling theloaded_model_summary().
screenshots illustrate that.Fourth stepfinally what you aim for, the classification step callingpredict_test()this function expect two args:
the test_ds, and the cls_test vector. the reason that is only predicting test is explaind below sections.
resul as the graph illustratesOptional way to employ bireyselvalueIf you like, I may suggest this way of employing the pacakge, for testing purpose.
basically we can relay on creatin functions. follow the steps as:create a training functioncreate a save model functioncreate a load model functioncreate a test model functionand finaly you may callmain()function on each one. Otherwise you may also useClass, all as you wish.Lest's see each function in action:training functinothe training function expectsfour args:the training dsthe training class vectorthe radius number0.1 <= r <= 0.99number of reportneighbors, assume 5Now, ifelements 3, and 4sound foreign to you, you should read the academic publication on
the method to understand their functions. Once that is done then you expect the functionreturnsinstanceof the bireyselvalue that isbuild and trained. Technically speaking, that isthe model to save.def train_bp_a(ds, cls, radius, report_num):
    '''this is the first main function on using this package, it expects 
    the ds, cls, and radius, and how many report you wish to see from the neighbors parameter. 
    it basically return the model for saving purpos
    '''
    inst = BireyselValue()
    inst.input_feature(ds=ds, cls=cls)
    inst.report_input()
    inst.build(radius=radius)
    inst.build_report(num=report_num)
    inst.train()
    inst.model_summary()
    
    return instsaving model functionThis function will savethe returned modelfrom the training section.
It expects two args and that isthe modeland thepath to save to.def save_model(inst,path_save):
    '''this function basically save the bp_a.v.1.0 model, requrist two args:
        1. the model to save that should be bp_a model instance
        2. the path of saving the model
    '''
    inst.save_model(file_name=path_save)loading model functionas the name suggests, we are going to load the model. the function expects ONEarg:
thepath to load from, and itreturnsthat model.def load_model(path_load):
    '''this function basically load the bp_a.v.1.0 model and return it, requires the path of the model to load'''
    model_path = path_load
    model = BireyselValue()
    model.load_model(model_path=model_path)
    model.loaded_model_summary()
    return modeltesting prediction functionthis is the final function to test the model. basically this function expects three args:
themodelwhich has been loaded, thetest dataset, and finally thevector class.
that is done then you feed all to the function, and you expect the result will be printed on the terminal.def test_bp_a(model, ds_test, cls_test):
    '''this function execute the test on bp_a. requires:
        1. model
        2. ds test
        3. cls test
        both must be following the loaded model summary
    '''
    model.predict_test(input_test_feature=ds_test, cls_test_feature=cls_test)Finally, you expected a printed report with accuracy on the terminal as:__________________________________________
*****************END*********************************
predict by neighbors :*********************
[0.30769231 0.         0.69230769]
actul is  2 predict 2
__________________________________________
*****************END*********************************
predict by neighbors :*********************
[0. 0. 1.]
actul is  2 predict 2
__________________________________________
*****************END*********************************
predict by neighbors :*********************
[0.63636364 0.         0.36363636]
actul is  2 predict 0
__________________________________________
*****************END*********************************Your prediction test has accuracy of **94.73684210526315 %**, by neighbors:call the four functions-main()you may follow this block to on the previous functions:# train model
inst = train_bp_a(ds=ds, cls=cls, radius=0.2, report_num=5)

# save the model
save_model(path_save=path_to_save, inst=inst)

# load model
model = load_model(path_load=path_to_load)

# test model
test_bp_a(ds_test=ds_test, cls_test=cls_test, model=model)Conclusion on installation and employingAs I have mentioned, there are strong and promising results, so far, have been shown
employing the proposed method. The results of accuracy on problematic datasets had ranged
between 80% up to 98%. I would like to draw your attention to the fact that IDIDN’T DO ANY CLEANINGwhatsoever on the datasets. The reason is yetto prove the potential of the method.
In other words, those result of accuracy is justpurewith no cleaning or similar actions.
So, what is next?.Future releaseIn the future release of the bireyselvalue you expect:Activation on the rest of four main characteristics of the method, these are: zone characteristic, and column wise characteristic.Expansion on various types of datasets such as images, and such.To have extra functions that will take care to prepare the dataset for you instead of manual preparation, such splitting the dataset and class vector.Thank you for your interest in trying the method and keep following future releases.Referenceplease follow up on the project page to find the academic published paper on the methodbireyselvalueproject.