How to use the mindsdb.CONFIG function in MindsDB

To help you get started, we’ve selected a few MindsDB examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mindsdb / mindsdb / mindsdb / libs / phases / model_trainer / model_trainer.py View on Github external
def test():
    from mindsdb.libs.controllers.predictor import Predictor
    from mindsdb import CONFIG

    CONFIG.DEBUG_BREAK_POINT = PHASE_MODEL_TRAINER

    mdb = Predictor(name='home_rentals')

    mdb.learn(
        from_data="https://raw.githubusercontent.com/mindsdb/mindsdb/master/docs/examples/basic/home_rentals.csv",
        # the path to the file where we can learn from, (note: can be url)
        to_predict='rental_price',  # the column we want to learn to predict given all the data in the file
        sample_margin_of_error=0.02,
        stop_training_in_x_seconds=10
    )
github mindsdb / mindsdb / mindsdb / libs / phases / stats_generator / stats_generator.py View on Github external
def test():
    from mindsdb.libs.controllers.predictor import Predictor
    from mindsdb import CONFIG

    CONFIG.DEBUG_BREAK_POINT = PHASE_STATS_GENERATOR

    mdb = Predictor(name='home_rentals')

    mdb.learn(
        from_data="https://s3.eu-west-2.amazonaws.com/mindsdb-example-data/home_rentals.csv",
        # the path to the file where we can learn from, (note: can be url)
        to_predict='rental_price',  # the column we want to learn to predict given all the data in the file
        sample_margin_of_error=0.02
    )
github mindsdb / mindsdb / mindsdb / libs / phases / data_extractor / data_extractor.py View on Github external
def test():
    from mindsdb.libs.controllers.predictor import Predictor
    from mindsdb import CONFIG

    CONFIG.DEBUG_BREAK_POINT = PHASE_DATA_EXTRACTOR

    mdb = Predictor(name='home_rentals')


    mdb.learn(
        from_data="https://s3.eu-west-2.amazonaws.com/mindsdb-example-data/home_rentals.csv",
        # the path to the file where we can learn from, (note: can be url)
        to_predict='rental_price',  # the column we want to learn to predict given all the data in the file
        sample_margin_of_error=0.02
    )
github mindsdb / mindsdb / mindsdb / libs / ml_models / pytorch / libs / base_model.py View on Github external
from mindsdb.libs.ml_models.pytorch.libs.torch_helpers import array_to_float_variable, variable_to_array
from mindsdb.libs.ml_models.pytorch.libs.torch_helpers import store_torch_object, get_stored_torch_object, LogLoss

from mindsdb.libs.data_types.trainer_response import TrainerResponse
from mindsdb.libs.data_types.tester_response import TesterResponse
from mindsdb.libs.data_types.file_saved_response import FileSavedResponse
from mindsdb.libs.helpers.train_helpers import getOneColPermutations


class BaseModel(nn.Module):

    variable_wrapper = array_to_float_variable
    variable_unwrapper = variable_to_array
    ignore_types = [DATA_TYPES.TEXT]
    use_full_text_input = False
    if CONFIG.USE_CUDA:
        torch.backends.cudnn.benchmark=True

    def __init__(self, sample_batch, **kwargs):
        """

        :param sample_batch:
        :type sample_batch: utils.
        :param use_cuda:
        :param kwargs:
        """
        super(BaseModel, self).__init__()

        self.lossFunction = LogLoss()
        self.errorFunction = LogLoss()
        self.sample_batch = sample_batch
github mindsdb / mindsdb / mindsdb / libs / data_types / mindsdb_logger.py View on Github external
elif type in ['list']:
                max_len = max([len(i) for i in message.keys()])
                len_format = " {: >" + str(max_len) + "}: "
                for key in message:
                    self.info(len_format.format(key) + '{val}'.format(val=message[key]))
            else:
                self.info(message)
                self.info('info type: {type}'.format(type=type))
            self.info(gen_chars(10, '-'))



main_logger_uuid = 'core-logger'
log = MindsdbLogger(log_level=CONFIG.DEFAULT_LOG_LEVEL, uuid=main_logger_uuid)
github mindsdb / mindsdb / mindsdb / libs / ml_models / pytorch / libs / base_model.py View on Github external
    def getLatestFromDisk(self, path = CONFIG.MINDSDB_STORAGE_PATH):
        """

        :return:
        """
        obj = get_stored_torch_object(self.latest_file_id, path)
        obj.eval()
        return obj
github mindsdb / mindsdb / mindsdb / libs / data_types / mindsdb_logger.py View on Github external
elif type in ['list']:
                max_len = max([len(i) for i in message.keys()])
                len_format = " {: >" + str(max_len) + "}: "
                for key in message:
                    self.info(len_format.format(key) + '{val}'.format(val=message[key]))
            else:
                self.info(message)
                self.info('info type: {type}'.format(type=type))
            self.info(gen_chars(10, '-'))



main_logger_uuid = 'core-logger'
log = MindsdbLogger(log_level=CONFIG.DEFAULT_LOG_LEVEL, log_url=None, send_logs=False, uuid=main_logger_uuid)
github mindsdb / mindsdb / mindsdb / libs / ml_models / pytorch / libs / base_model.py View on Github external
from mindsdb.libs.ml_models.pytorch.libs.torch_helpers import array_to_float_variable, variable_to_array
from mindsdb.libs.ml_models.pytorch.libs.torch_helpers import store_torch_object, get_stored_torch_object, LogLoss

from mindsdb.libs.data_types.trainer_response import TrainerResponse
from mindsdb.libs.data_types.tester_response import TesterResponse
from mindsdb.libs.data_types.file_saved_response import FileSavedResponse
from mindsdb.libs.helpers.train_helpers import getOneColPermutations


class BaseModel(nn.Module):

    variable_wrapper = array_to_float_variable
    variable_unwrapper = variable_to_array
    ignore_types = [DATA_TYPES.SEQUENTIAL]
    use_full_text_input = False
    if CONFIG.USE_CUDA:
        torch.backends.cudnn.benchmark=True

    def __init__(self, sample_batch, **kwargs):
        """

        :param sample_batch:
        :type sample_batch: utils.
        :param use_cuda:
        :param kwargs:
        """
        super(BaseModel, self).__init__()

        self.lossFunction = LogLoss()
        self.errorFunction = LogLoss()
        self.sample_batch = sample_batch