00001 /* 00002 * Copyright (c) 2009 Yahoo! Inc. All rights reserved. The copyrights 00003 * embodied in the content of this file are licensed under the BSD 00004 * (revised) open source license. 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * Written (W) 2011 Shashwat Lal Das 00012 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society. 00013 */ 00014 00015 #include <shogun/classifier/vw/VwEnvironment.h> 00016 00017 using namespace shogun; 00018 00019 CVwEnvironment::CVwEnvironment() 00020 : CSGObject(), vw_version("5.1"), v_length(4) 00021 { 00022 init(); 00023 } 00024 00025 void CVwEnvironment::init() 00026 { 00027 num_bits = 18; 00028 thread_bits = 0; 00029 mask = (1 << num_bits) - 1; 00030 stride = 1; 00031 00032 min_label = 0.; 00033 max_label = 1.; 00034 00035 eta = 10.; 00036 eta_decay_rate = 1.; 00037 00038 adaptive = false; 00039 exact_adaptive_norm = false; 00040 l1_regularization = 0.; 00041 00042 random_weights = false; 00043 initial_weight = 0.; 00044 00045 update_sum = 0.; 00046 00047 t = 1.; 00048 initial_t = 1.; 00049 power_t = 0.5; 00050 00051 example_number = 0; 00052 weighted_examples = 0.; 00053 weighted_unlabeled_examples = 0.; 00054 weighted_labels = 0.; 00055 total_features = 0; 00056 sum_loss = 0.; 00057 passes_complete = 0; 00058 num_passes = 1; 00059 00060 ngram = 0; 00061 skips = 0; 00062 00063 ignore_some = false; 00064 00065 vw_size_t len = ((vw_size_t) 1) << num_bits; 00066 thread_mask = (stride * (len >> thread_bits)) - 1; 00067 } 00068 00069 void CVwEnvironment::set_stride(vw_size_t new_stride) 00070 { 00071 stride = new_stride; 00072 vw_size_t len = ((vw_size_t) 1) << num_bits; 00073 thread_mask = (stride * (len >> thread_bits)) - 1; 00074 }