## how to fix relationship error between models?

how to detect overfitting in logistic regression

how to check if the model is overfitting or underfitting

errors-in-variables models

specification errors in regression models

how to check overfitting in python

measurement error models in r

overfitting minitab

I have set up two models and made the relationship between them. I want to pass the attributes of the user as well as the `user_detail`

.

I have used a similar code somewhere and it worked perfectly. But it is not working here.

//This is the function in "User.php" model. public function user_detail(){ return $this->hasOne('App\Profile'); } //This is the function in "Profile.php" model. public function user(){ return $this->belongsTo('App\User'); } //edit function in ProfileController public function edit($id) { $user=User::find($id); return view('profile.edit')->with('data',$user->user_detail); }

When I click the edit button in the view, I expect the extract all the details from user table as well as from `user_detail`

table.

I think you should edit your this code a little bit

public function edit($id) { $user=User::findOrFail($id); return view('profile.edit')->with('data',$user); }

And in your blade file (profile.edit), You can get all details from User and Profile Model.

{{ $data->id }} {{ $data->user_detail->YOURPARAMETERS }}

**Overfitting Regression Models: Problems, Detection, and Avoidance ,** In this post, I explain how overfitting models is a problem and how you can identify The green line represents the true relationship between the variables. The random error inherent in the data causes the data points to fall randomly around Multivariable linear model. Multivariable model looks exactly like the simple linear model, only this time β, η t, x t and x* t are k×1 vectors. {= + ′ ∗ +, = ∗ +.The general identifiability condition for this model remains an open question.

The problem is with the relationship naming. Make it camelCase like,

//This is the function in "User.php" model. public function userDetail(){ return $this->hasOne('App\Profile'); } //edit function in ProfileController public function edit($id) { $user=User::find($id); return view('profile.edit')->with('data',$user->userDetail); }

Reference: https://github.com/laravel/framework/issues/4307#issuecomment-42037712

**3.3 Relationship between variables: linear models and correlation ,** 3.3 Relationship between variables: linear models and correlation Y values, there will be some error associated with each prediction when we compare it to the original We can also think of this problem from more a statistical point of view. If you create a scatter plot of values for x and y and see that there is not a linear relationship between the two variables, then you have a couple options: 1. Apply a nonlinear transformation to the independent and/or dependent variable.

try using `where`

instead of `find`

and then use `with`

:

$user = User::where('id', $id)->with('user_detail')->first(); return view('profile.edit')->with('data', $user);

In your **model**:

public function user_detail(){ return $this->hasOne('App\Profile', 'student_no'); }

**What Is Specification Error in Statistical Models?,** When we think about model assumptions, we tend to focus on assumptions like It's often the case that the relationship between a predictor X and Y isn't a Many times (though not always) the fix is simple: a log transformation of X or an I haven't. I guess the reasion I couldn't do it using my original model was because the relationships were not one to one. I have since found in some cases where the relationships were one to one I could achieve it. Maybe when the relationship is one to many PBI doesn't know which one I want to pick so it just doesn't do it.

**Errors-in-variables models,** In statistics, errors-in-variables models or measurement error models are regression models Consider a simple linear regression model of the form The relationship between the measurement error η {\displaystyle \eta } \eta the reliability ratio as λ = ( σ² x − σ² η) / σ² x and reduce the problem to the previous case. One straightforward method is to do a Train-Test Split of your data. For instance, train your model on 70% of your data, and then measure its error rate on the remaining 30% of data. If your model has high error in both the train and test datasets, you know your model is underfitting both sets and has High Bias.

**How to compare regression models,** It is defined as the mean absolute error of the model divided by the mean absolute If an occasional large error is not a problem in your decision situation (e.g., Bi-directional cross filters can be an easy fix to the many-to-many query design problem that has challenged tabular and Power Pivot developers in the past. If you've used the DAX workaround for many-to-many relationships in tabular or Power Pivot models, you can try applying a two-way filter to see if it produces expected results.

**Chapter 7: Correlation and Simple Linear Regression,** Plot 1 shows little linear relationship between x and y variables. Plot 2 shows a strong This is the standard deviation of the model errors. It measures the variation This problem differs from constructing a confidence interval for μy. Instead of The entity-relationship diagram above has a 'crow’s foot' connection at each end, illustrating that there is a many-to-many relationship between ticket holders and concert performances, as one ticket holder may attend many performances, and each performance is likely to have many ticket holders present.

##### Comments

- What is your exact Laravel version?
- Are you sure has a
`user_id`

field on your`profiles`

table? - no, I am using student number as user_id. I have student no. on both tables and are unique, but not the primary key. What should I do?
- This is not working. could you look for another solution? I am still stuck on this issue.
- Is it possible for you to share your database schema?
- i have 2 tables. Users table and user_detail table. i have student number on both the tables which is not primary key but is unique. both tables have other details such as email, CID, name, etc..
- If there is no primary key then it causes a problem to manage a relationship. Please update your question with database schema so we can help you exactly from there.
- it is not must, it should be an advice. I can use as
`function_name`

of method name always. - Yes. But Laravel 4.2 enforces this. That's why I asked his Laravel version.
- I have even tried with camelCase. it's not working. Another approach, please!
- Then please share your schema as well.
- the model name is Profile but table name is user_detail. user_detail as $id,student_no,email,CID, etc. i am trying to show data of same student number in user table and userr_detail table.
- I edited my answer, can you try it again and tell me if it still doesn't work