 book and choose books carefully. To this day, this is my strategy due to shortage of time and availability of millions of books which I can read.
Some of these books can have huge impact at one’s life. Few of my favorite books are The magic of thinking big, Success principles, Think and Grow Rich and the list goes on… I read more than 100 self-help books and all drilled down to same basic principles.
If you want to get successful in life, you must take 100% responsibility of your life. Jack Canfield in his book Success Principles wrote that stop making excuses and looking miserable. Start taking 100% responsibility of your life. Once you start taking responsibility, you will start taking actions to improve it and this is most important for the life you want. You can only achieve it once you start take responsibility. Success has no diploma. It doesn’t require any prerequisite, certification, background, nationality or wealth. There are many people in this world who were broke, poor, immigrant but still they got massive success in life and you can too become successful if you start taking responsibility of your actions and its consequences.
If your mind can conceive & imagine, you have all the powers to become the person you want to be. You have given all powers, talents, capabilities and gifts to become the person you want to be. Nothing is impossible in this world. The only thing is you have to take responsibility and then have belief on what you want to be and give your 100% effort.
Dreams remain dreams and wishes until you start working on them.  Motion creates momentum which will help you to get rid of fear and breed confidence. Dreams will come true if you work on them. Start working on your dreams every single day!
People are what they think of themselves. In my life, I have met people who are happy and people who are miserable. The only thing that separates happy people from miserable people are their thoughts. If you are sad, that is probably you are thinking bad about yourself. If you want, you can be happy by just focusing your thoughts on happiness. And the same is true for success or whatever you want to achieve in your life. You need to focus your thoughts and visualize success and then believe on it. Life will change once you change your thoughts and you will be more happy and successful.
Fear has killed more dreams than anything else in this world. People don’t pursue their dreams because of the fear of other people’s opinions about themselves. What others will think about you is none of your business. The only way to get rid of this fear is to stop imagining yourself miserable and start loving yourself. Once you start loving yourself, your thoughts will improve and your self-confidence will boost. You understand what is success and happiness and fully focus on achieving your goals and living the life you deserve.
There is supreme power (whatever you call, I call HIM as GOD) which is far bigger than us and is constantly aware about our actions. Have a trust and faith on this supreme power!
How can we get help from this power? There are moments in life when we are terrified and have doubts. In those moments, we should always focus on our efforts and rest leave this onto God and He will work along with us. I have survived in everything that has happened to me in past and I will continue to survive what will come in future. The only way is to apply the above principles of responsibility, action, thinking, self-love and extreme Power (God) will always reward us the best.
Everyone of you is special and your dreams are worth too. You deserve far better life than you have. If you can dream, you have the power, talents and abilities to achieve those dreams as well. The only thing you need to do is to take action EVERY SINGLE DAY towards your goals and dreams. Once you start taking action, you are already on a path to massive success. Rest is your belief. Believe that it can be done and your subconscious mind will find ways to make it possible.
<reponame>carldea/rapaio
/*
 * Apache License
 * Version 2.0, January 2004
 * http://www.apache.org/licenses/
 *
 * Copyright 2013 - 2021 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package rapaio.ml.eval;

import rapaio.data.Frame;
import rapaio.data.Var;
import rapaio.ml.classifier.ClassifierModel;
import rapaio.ml.classifier.ClassifierResult;
import rapaio.ml.common.ListParam;
import rapaio.ml.common.ParamSet;
import rapaio.ml.common.ValueParam;
import rapaio.ml.eval.metric.Accuracy;
import rapaio.ml.eval.metric.ClassifierMetric;
import rapaio.ml.eval.split.KFold;
import rapaio.ml.eval.split.Split;
import rapaio.ml.eval.split.SplitStrategy;
import rapaio.ml.eval.split.StratifiedKFold;
import rapaio.sys.WS;

import java.io.Serial;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * Classifier evaluation tool.
 *
 * <p>
 * Created by <a href="mailto:<EMAIL>"><NAME></a> on 2/26/20.
 */
public class ClassifierEvaluation extends ParamSet<ClassifierEvaluation> {

    @Serial
    private static final long serialVersionUID = 8533424311527093792L;

    public static ClassifierEvaluation eval(Frame df, String targetName, ClassifierModel model, ClassifierMetric... metrics) {
        return new ClassifierEvaluation()
               .data.set(df)
               .targetName.set(targetName)
               .model.set(model)
               .metrics.set(metrics);
    }

    public static ClassifierEvaluation cv(Frame df, String targetName, ClassifierModel model, int folds, ClassifierMetric... metrics) {
        return new ClassifierEvaluation()
               .data.set(df)
               .targetName.set(targetName)
               .model.set(model)
               .splitStrategy.set(new StratifiedKFold(folds, targetName))
               .metrics.set(metrics);
    }

    public final ValueParam<ClassifierModel, ClassifierEvaluation> model = new ValueParam<>(this,
            null, "model", "Classification model.");

    public final ValueParam<Frame, ClassifierEvaluation> data = new ValueParam<>(this,
            null, "df", "Data frame");

    public final ValueParam<Var, ClassifierEvaluation> weights = new ValueParam<>(this,
            null, "weights", "Weights");

    public final ValueParam<String, ClassifierEvaluation> targetName = new ValueParam<>(this,
            null, "target", "Target variable name");

    public final ValueParam<SplitStrategy, ClassifierEvaluation> splitStrategy = new ValueParam<>(this,
            new KFold(10), "splitStrategy", "Split strategy used to obtain train and validation data sets.");

    public final ValueParam<Integer, ClassifierEvaluation> threads = new ValueParam<>(this,
            1, "threads", "Number of threads used for evaluation.");

    public final ListParam<ClassifierMetric, ClassifierEvaluation> metrics = new ListParam<>(this,
            List.of(Accuracy.newMetric()), "metrics", "Metrics used at evaluation time.", (in, out) -> true);

    public ClassifierEvaluationResult run() {
        ExecutorService executorService = Executors.newFixedThreadPool(threads.get());
        List<Future<Run>> futures = new LinkedList<>();

        // create features for parallel execution

        List<Split> splits = splitStrategy.get().generateSplits(data.get(), weights.get());

        for (Split split : splits) {
            Future<Run> futureRun = executorService.submit(() -> {
                var m = model.get().newInstance();
                m.fit(split.trainDf(), targetName.get());
                var trainResult = m.predict(split.trainDf(), true, true);
                var testResult = m.predict(split.testDf(), true, true);
                return new Run(split, trainResult, testResult);
            });
            futures.add(futureRun);
        }

        Class