Search Results

Search found 13429 results on 538 pages for 'model reject'.

Page 69/538 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Short Season, Long Models - Dealing with Seasonality

    - by Michel Adar
    Accounting for seasonality presents a challenge for the accurate prediction of events. Examples of seasonality include: ·         Boxed cosmetics sets are more popular during Christmas. They sell at other times of the year, but they rise higher than other products during the holiday season. ·         Interest in a promotion rises around the time advertising on TV airs ·         Interest in the Sports section of a newspaper rises when there is a big football match There are several ways of dealing with seasonality in predictions. Time Windows If the length of the model time windows is short enough relative to the seasonality effect, then the models will see only seasonal data, and therefore will be accurate in their predictions. For example, a model with a weekly time window may be quick enough to adapt during the holiday season. In order for time windows to be useful in dealing with seasonality it is necessary that: The time window is significantly shorter than the season changes There is enough volume of data in the short time windows to produce an accurate model An additional issue to consider is that sometimes the season may have an abrupt end, for example the day after Christmas. Input Data If available, it is possible to include the seasonality effect in the input data for the model. For example the customer record may include a list of all the promotions advertised in the area of residence. A model with these inputs will have to learn the effect of the input. It is possible to learn it specific to the promotion – and by the way learn about inter-promotion cross feeding – by leaving the list of ads as it is; or it is possible to learn the general effect by having a flag that indicates if the promotion is being advertised. For inputs to properly represent the effect in the model it is necessary that: The model sees enough events with the input present. For example, by virtue of the model lifetime (or time window) being long enough to see several “seasons” or by having enough volume for the model to learn seasonality quickly. Proportional Frequency If we create a model that ignores seasonality it is possible to use that model to predict how the specific person likelihood differs from average. If we have a divergence from average then we can transfer that divergence proportionally to the observed frequency at the time of the prediction. Definitions: Ft = trailing average frequency of the event at time “t”. The average is done over a suitable period of to achieve a statistical significant estimate. F = average frequency as seen by the model. L = likelihood predicted by the model for a specific person Lt = predicted likelihood proportionally scaled for time “t”. If the model is good at predicting deviation from average, and this holds over the interesting range of seasons, then we can estimate Lt as: Lt = L * (Ft / F) Considering that: L = (L – F) + F Substituting we get: Lt = [(L – F) + F] * (Ft / F) Which simplifies to: (i)                  Lt = (L – F) * (Ft / F)  +  Ft This latest expression can be understood as “The adjusted likelihood at time t is the average likelihood at time t plus the effect from the model, which is calculated as the difference from average time the proportion of frequencies”. The formula above assumes a linear translation of the proportion. It is possible to generalize the formula using a factor which we will call “a” as follows: (ii)                Lt = (L – F) * (Ft / F) * a  +  Ft It is also possible to use a formula that does not scale the difference, like: (iii)               Lt = (L – F) * a  +  Ft While these formulas seem reasonable, they should be taken as hypothesis to be proven with empirical data. A theoretical analysis provides the following insights: The Cumulative Gains Chart (lift) should stay the same, as at any given time the order of the likelihood for different customers is preserved If F is equal to Ft then the formula reverts to “L” If (Ft = 0) then Lt in (i) and (ii) is 0 It is possible for Lt to be above 1. If it is desired to avoid going over 1, for relatively high base frequencies it is possible to use a relative interpretation of the multiplicative factor. For example, if we say that Y is twice as likely as X, then we can interpret this sentence as: If X is 3%, then Y is 6% If X is 11%, then Y is 22% If X is 70%, then Y is 85% - in this case we interpret “twice as likely” as “half as likely to not happen” Applying this reasoning to (i) for example we would get: If (L < F) or (Ft < (1 / ((L/F) + 1)) Then  Lt = L * (Ft / F) Else Lt = 1 – (F / L) + (Ft * F / L)  

    Read the article

  • getJSON not working if the mvc model view controller has a parameter

    - by Paul
    I'm having an issue with a callback. I'm not even getting an error in Firebug. If I alert before and after the getjson call both alerts show but the getjson call doesn't fire. public ActionResult TestPage() { return View(); } public ActionResult LoadMapLonLats(int mapId) { //some code return Json(_myMaps); } $("#Search").click(function() { $.getJSON("LoadMapLonLats", { mapId: 73 }, loadDbMap); }); function loadDbMap(maps) { alert('m'); $.each(maps, function(i) { alert(maps[i]); }); } As long as I leave TestPage without a parameter is works. If I add a parameter to TestPage(int id) then the call back to LoadMapLonLats doesn't work. Seems odd. Of course TestPage is the page I'm loading so I need to do some work here before rendering the page. Not sure why adding a parameter to the view would break the callback to another function. //this breaks he callback to LoadMapLonLats public ActionResult TestPage(int id) { return View(); } Any ideas? Seems like this may be related, if not sorry I can post a new thread.

    Read the article

  • Use Html.RadioButtonFor and Html.LabelFor for the same Model but different values

    - by Marc
    I have this Razor Template <table> <tr> <td>@Html.RadioButtonFor(i => i.Value, "1")</td> <td>@Html.LabelFor(i => i.Value, "true")</td> </tr> <tr> <td>@Html.RadioButtonFor(i => i.Value, "0")</td> <td>@Html.LabelFor(i => i.Value, "false")</td> </tr> </table> That gives me this HTML <table> <tr> <td><input id="Items_1__Value" name="Items[1].Value" type="radio" value="1" /></td> <td><label for="Items_1__Value">true</label></td> </tr> <tr> <td><input checked="checked" id="Items_1__Value" name="Items[1].Value" type="radio" value="0" /></td> <td><label for="Items_1__Value">false</label></td> </tr> </table> So I have the ID Items_1__Value twice which is - of course - not good and does not work in a browser when I click on the second label "false" the first radio will be activated. I know I could add an own Id at RadioButtonFor and refer to that with my label, but that's not pretty good, is it? Especially because I'm in a loop and cannot just use the name "value" with an added number, that would be end up in multiple Dom Ids in my final HTML markup as well. Shouldn't be a good solution for this?

    Read the article

  • MVVM- Trigger Storyboard in the View Model in Silverlight

    - by user275561
    I have a couple of Storyboards in my view that I would like to trigger from the ViewModel if possible. Is there a simple way or elegant way of doing this. Here is what I am trying to do. Person Clicks on a Button--RelayCommand (In the ViewModel), the Relay Command should then play the storyboard. Also one more thing, I would like to also trigger the storyboard animation by itself in the ViewModel without any interaction. <i:Interaction.Triggers> <i:EventTrigger EventName="MouseLeftButtonDown"> <cmd:EventToCommand Command="{Binding ButtonPress}" CommandParameterValue="RedButtonLight"> </cmd:EventToCommand> </i:EventTrigger> </i:Interaction.Triggers>

    Read the article

  • ASP.NET MVC 2 JQuery POST not displaying the model state errors

    - by Oshan
    Hello, I have been using asp.net mvc for a bit (but I'm still a beginer). I want to have the ability to update two views as a result of a jquery postback. Basically I have a list and a details view. The details view is presented using a jquery popup (using jquery-UI popup). I only want to update the list if the details save is successful (i.e. there are no validation errors on the details view). However, if there are any validation errros in the details view, I want to update the details view so that the user sees the validation errors. so I thought in my controller, I return a JsonResult instead of a View. [HttpPost] public ActionResult SavePersonInfo(Person p) { if(ModelState.Valid) { return View("PersonList"); } return Json({Error = true, View = PartialView("PersonDetails", p)}); } As you can see if there are no errors I return the person list view, but if there are any validation errors, I have return the details view. The reason that I'm returning a JsonResult is I need to tell my view there is an error so that the view (jquery) knows which section to update (as in whether to update the person list 'div' or the popup dialog 'div'). So, in my view, the jquery is as follows (please assume that there is a form for entering in the person details and "SubmitPersonForm();" function is called upon clicking on the "Save" button): <script type="text/javascript> $('#btnSave').click(function (event) { onBegin(); $.ajax( { type: "POST", url: "/Person/Save", data: $('form').serialize(), success: function (result) { if(result.Error) { $('#dvDetails').html($(result).View)); } else { $('#dvPersonList').html($result); } } }); }); </script> So the problem that I have now, is that when there is a validation error, I do see the correct, 'div' being updated, but I lose the asp.net mvc validation messages. I do not see any validation errors in red, as if ASP.NET MVC is completely ignored them. However, my ModelState does have those errros, just not displayed in the details view. I do have valication summary and Html.ValidationFor(m = ...) statements put in my details view. Could someone tell me why I'm not seeing the validation errors? although I'm using a JSonResult, I do use the right property which is a valid view when I render the 'dvDetails'. Am I doing something that I'm not suppose to in asp.net mvc? Btw I'm using asp.net mvc2 RC with Visual Studio 2010 RC. Thank you.

    Read the article

  • Entity Data Model & DataGridView - Creating new objects

    - by AcousticBoom
    I'm pretty new to the EDM, so bear with me. I have a windows form that has a DataGridView on it that's bound from the EDM I created. I figured out how to update my changes fine, but it's when the user creates a new row that I'm having a problem. I tried numerous ways and many google searches, but came up with nothing so far. Here's how the data is loaded: Dim boilerID As Integer = DirectCast(ddlBoiler.SelectedValue, Integer) Dim countryID As Integer = DirectCast(ddlCountry.SelectedValue, Integer) Dim ratings = From r In _Context.Rating _ Where r.Boiler.Boiler_ID = boilerID _ And r.Country.Country_ID = countryID _ Order By r.Sequence _ Select r RatingBindingSource.DataSource = ratings.ToList() Also, all I'm doing to save the information right now is the following: Private Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click _Context.SaveChanges() End Sub I want the user to be able to use the grid's "new row" feature to add new items to the database instead of having to click a button and open a new dialog. How would this be accomplished? I can include some of the methods i tried for adding new items if anyone needs to see. Thanks!

    Read the article

  • Django admin, hide a model

    - by Hellnar
    Hello At the root page of the admin site where registered models appear, I want to hide several models that are registered to the Django admin. If I directly unregister those, I am not able to add new records as the add new symbol "+" dissapears. How can this be done ?

    Read the article

  • wpf toolkit (Feb 2010) datagrid with MVVM - style reveals name of view model on 'spare column'

    - by Andy Clarke
    Hi, I've just updated my app with the latest WPF toolkit and I've now got an issue with my styling. When I bind some data with, for example, two columns to the grid, the spare area at the right shows the name of the ViewModel in the header. I can understand why, because the data grids data context is the ViewModel and I'm defining my header style as follows ... <WpfToolkit:DataGridHeaderBorder <Border BorderBrush="Blue" BorderThickness="0,1,0,0"> <TextBlock Text="{Binding}" Margin="4,0,4,0" /> </Border> </WpfToolkit:DataGridHeaderBorder> Do I now need a separate style for the 'spare column' or something? Can anyone assist please? Cheers, Andy

    Read the article

  • Generate a form from an untyped mvc 2 model or dictionary

    - by user329251
    HI all, I am looking for a way to generate and validate mvc 2 forms using untyped entities. Basically similar how the propertygrid in winforms behaves. In the utmost basic sample for instance have an dictionary and generate a form from that depending on the datatype in the Dictionary ofcourse it should be able to fill the same dictionary in the controller. Any ideas or leads or hints? Best regards, Emile

    Read the article

  • Where can I find Object Model Documentation for Microsoft Expression Web Add-ins

    - by JonStonecash
    I am working on an add-in for Microsoft Expression Web. I have gotten enough information on the web to know that I have to add references to Microsoft.Expression.Interop.WebDesigner, Microsoft.Expression.Interop.WebDesignerPage, and Microsoft.Expression.Interop.WebDesigner. The problem is that there does not seem to be any official documentation on the classes within these dll-s. There is even a Microsoft Connect issue about the lack of documentation. I have been using the object browser in Visual Studio 2008 and Reflector but that is pretty thin soup. Does anyone know where there is some reasonable documentation. I am not looking for a sample "hello world" implementation. I want some more substance and depth.

    Read the article

  • Using fields from an association (has_one) model with formtastic in rails

    - by subprime
    I searched and tried a lot, but I can't accomplish it as I want.. so here's my problem. My models are: class User < ActiveRecord::Base has_one :profile accepts_nested_attributes_for :profile end class Profile < ActiveRecord::Base attr_accessible :user_id, :form, :title, :name, :surname, :street, :housenumber, :zipcode, :place, :phone, :mobile, :fax, :url belongs_to :user end In my view: <% semantic_form_for @user do |form| %> <%= form.inputs :login, :email, :password%> <% form.semantic_fields_for :profile do |profile| %> <%= profile.inputs %> <% end %> <%= form.buttons %> <% end %> My problem is that when I edit a person then it shows me the data on the profile. I would, that the fields from the profile even when creating a user are displayed. Thanks a lot!

    Read the article

  • Formtastic nested model form fields (Rails 3)

    - by elsurudo
    So here's the scenario: User: has_one :company accepts_nested_attributes_for :company Controller: @user = User.new @user.build_company View: <% semantic_form_for @user, :url => register_path do |form| %> <h2>User Information</h2> <%= form.inputs %> <h2>Company Information</h2> <% form.semantic_fields_for :company do |company| %> <%= company.inputs %> <% end %> <%= form.buttons %> <% end %> After scouring the web, this SEEMS like it should work. However, all I get are the user inputs. The "semantic_fields_for :company" block outputs nothing at all... Am I missing something here, or is this perhaps a Rails 3 bug to do with Formtastic?

    Read the article

  • Tricky model inheritance - Django

    - by RadiantHex
    Hi folks, I think this is a bit tricky, at least for me. :) So I have 4 models Person, Singer, Bassist and Ninja. Singer, Bassist and Ninja inherit from Person. The problem is that each Person can be any of its subclasses. e.g. A person can be a Singer and a Ninja. Another Person can be a Bassist and a Ninja. Another one can be all three. How should I organise my models? Help would be much appreciated!

    Read the article

  • generate only objectLayer of Entity Framework Model by edmgen tool

    - by loviji
    How to generate only objectLayer by edmgen tool, without generating csdl, ssdl and views ? *"%windir%\Microsoft.NET\Framework\v4.0.30319\edmgen.exe" /mode:fullgeneration /c:"Data Source=.\sqlexpress; Initial Catalog=uqs; Integrated Security=SSPI" /project:generateEntityModel /entitycontainer:uqsEntities /namespace:uqsModel /language:CSharp /outobjectlayer:"D:/uqsObjectLayer.cs" * in this script I don't write location to write csdl, ssdl and views , but they are generated in C:\Users\adminUser in windows Vista and objectLayer generated to D:/uqsObjectLayer.cs. If I use /mode:EntityClassGeneration, this option requires the /incsdl argument and either the /project argument or the /outobjectlayer argument. The /language argument is optional. But I don't want use csdl file. As I understand, edmgen.tool can not create objectlayer without csdl file. Now is there alternate way or tool for generating objectlayer from db?

    Read the article

  • Ruby on Rails has_one Model Not Supplying ID Column

    - by Metric Scantlings
    I have a legacy rails (version 1.2.3) app which runs without issue on a number of servers (not to mention my local environment). Deployed to its newest server, though, and I now get ActiveRecord::StatementInvalid: Mysql::Error: #23000Column 'video_id' cannot be null errors. Below are the models/relationships, simplified: class Video < ActiveRecord::Base has_one(:user, :dependent => :destroy) end class User < ActiveRecord::Base belongs_to(:video) end And below is a rails console transcript of the relationships failing: >> video = Video.create(:title => 'New Video') => #<Video:0xb6d5e31c>... >> video.id => 5 >> video.user = User.create(:name => 'Tester') ActiveRecord::StatementInvalid: Mysql::Error: #23000Column 'video_id' cannot be null: INSERT INTO users (`name`, `video_id`) VALUES('Tester', NULL) from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:128:in `log' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:243:in `execute' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:253:in `insert' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1811:in `create_without_callbacks' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:254:in `create_without_timestamps' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/timestamp.rb:39:in `create' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1789:in `create_or_update_without_callbacks' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/callbacks.rb:242:in `create_or_update' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1545:in `save_without_validation' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/validations.rb:752:in `save_without_transactions' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:129:in `save' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in `transaction' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:95:in `transaction' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:121:in `transaction' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:129:in `save' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:451:in `create' from (irb):3 from :0 Has anyone else come across ActiveRecord not sending an ID when it clearly knows it?

    Read the article

  • No-Model Formtastic Form

    - by Kevin Sylvestre
    I am looking to reproduce the following with Formtastic: <% form_tag '/search', :method => 'get' do %> <%= text_field_tag :q, params[:q] %> <% end %> So far I have: <% semantic_form_for :search, :html => { :method => :get } do |form| %> <% form.inputs do %> <%= form.input :q %> <% end %> <% end %> However, this requires access to the parameter hash using: params[:search][:q] Instead of my required: params[:q] I'd like to use Formtastic for all forms in the application I am working on, and so far I have only had problems with this one. Any ideas?

    Read the article

  • How to add and remove nested model fields dynamically using Haml and Formtastic

    - by Brightbyte8
    We've all seen the brilliant complex forms railscast where Ryan Bates explains how to dynamically add or remove nested objects within the parent object form using Javascript. Has anyone got any ideas about how these methods need to be modified so as to work with Haml Formtastic? To add some context here's a simplified version of the problem I'm currently facing: # Teacher form (which has nested subject forms) [from my application] - semantic_form_for(@teacher) do |form| - form.inputs do = form.input :first_name = form.input :surname = form.input :city = render 'subject_fields', :form => form = link_to_add_fields "Add Subject", form, :subjects # Individual Subject form partial [from my application] - form.fields_for :subjects do |ff| #subject_field = ff.input :name = ff.input :exam = ff.input :level = ff.hidden_field :_destroy = link_to_remove_fields "Remove Subject", ff # Application Helper (straight from Railscasts) def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)") end def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)} \")")) end #Application.js (straight from Railscasts) function remove_fields(link) { $(link).previous("input[type=hidden]").value = "1"; $(link).up(".fields").hide(); } function add_fields(link, association, content) { var new_id = new Date().getTime(); var regexp = new RegExp("new_" + association, "g") $(link).up().insert({ before: content.replace(regexp, new_id) }); } The problem with implementation seems to be with the javascript methods - the DOM tree of a Formtastic form differs greatly from a regular rails form. I've seen this question asked online a few times but haven't come across an answer yet - now you know that help will be appreciated by more than just me! Jack

    Read the article

  • The subscription model behind CSS selectors?

    - by Martin Kristiansen
    With CSS selectors a query string body > h1.span subscribes to a specific type of nodes in the tree. Does anyone know how this is done? Selectors for transformations, how does the browser select the result set? And is there a trick to making it efficient? I imagine there being some sort of hierarchical type-tree for the entire structure to which the nodes subscribe and which is what is used when doing the selector queries — but this is only a guess. Does anyone know the real answer? Or even more interesting, what would be the best way to do dynamic lookups on a tree based on jQuery/CSS search queries?

    Read the article

  • ASP.NET MVC Model Binding

    - by Noel
    If i have a Controller Action that may recieve both HTTP GET and HTTP POST from a number of different sources with each source sending different data e.g. Source1 performs a form POST with two form items Item1 and Item2 Source2 performs a GET where the data is contained in the query string (?ItemX=2&ItemY=3) Is it possible to have a controller action that will cater for all these cases and perform binding automatically e.g. public ActionResult Test(Dictionary data) { // Do work ... return View(); } Is this possible with a custom binder or some other way? Dont want to work directly with HttpContext.Request if possible

    Read the article

  • Find which alias method is called in rails model

    - by Kashif Umair Liaqat
    I am new to rails development. I have created some aliases to a method and I want to know that which alias is called. I have this code. alias_method :net_stock_quantity_equals :net_stock_quantity alias_method :net_stock_quantity_gte :net_stock_quantity alias_method :net_stock_quantity_lte :net_stock_quantity alias_method :net_stock_quantity_gt :net_stock_quantity alias_method :net_stock_quantity_lt :net_stock_quantity def net_stock_quantity #some code here end I want to know that user has called which alias. Like if user calls net_stock_quantity_equals then I should know that the user has called net_stock_quantity_equals not net_stock_quantity. Any help would be appreciated.

    Read the article

  • WPF Prism MVVM, Internationalized Wizard Passing model data between the wizard steps

    - by Nick V
    I've found the following example of a wizard located here: http://www.codeproject.com/Articles/31837/Creating-an-Internationalized-Wizard-in-WPF Now I've spent quite some time looking at the example and i understand pretty much everything. But i can't figure out how he passes an object between the different modelViews. And as you can imagine that step is quite crucial.. In the example he uses an CupOfCoffee Object in the main wizardviewmodel and somehow manages to adjust it throughout the wizard. But i cant see anywhere how he does that. I've already tried to recreate a project like he has but no success. Could anyone tell me how he passes the objects between the different viewModels?

    Read the article

  • How to avoid saving a blank model which attributes can be blank

    - by auralbee
    Hello people, I have two models with a HABTM association, let´s say book and author. class Book has_and_belongs_to_many :authors end class Author has_and_belongs_to_many :books end The author has a set of attributes (e.g. first-name,last-name,age) that can all be blank (see validation). validates_length_of :first_name, :maximum => 255, :allow_blank => true, :allow_nil => false In the books_controller, I do the following to append all authors to a book in one step: @book = Book.new(params[:book]) @book.authors.build(params[:book][:authors].values) My question: What would be the easiest way to avoid the saving of authors which fields are all blank to prevent too much "noise" in the database? At the moment, I do the following: validate :must_have_some_data def must_have_some_data empty = true hash = self.attributes hash.delete("created_at") hash.delete("updated_at") hash.each_value do |value| empty = false if value.present? end if (empty) errors.add_to_base("Fields do not contain any data.") end end Maybe there is an more elegant, Rails-like way to do that. Thanks.

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >