What is the proper way to design models in a typical user-profile social system?

I want to create a system in Django where each user has a profile, an album of pics and a location, including country, region and city. The system will require users who are mens to confirm their account by mobile phone number. The system will also use some OAuth later and will have at least three different privileges systems, depending on user privileges. I would like to divide it into the following entities:

Account <- User -> Profile

and Profile will point to separate entities such as AdvancedProfile, PicsAlbum and Location (wich will probably be represented by a separated database or even by a third party). The location will be used extensively in searches and by the business logic.

I would divide the models with their fields in this way

Account User Profile
expire email username
auto_renew password gender
points mob_phone birthdate
next_bill groups profile_pic
etc. is_staff is_active
is_superuser album_id (one to many)
date_joined last_login
etc. location_id (will use third party)

The User would extend AbstractBaseUser and the idea behind separating the User model from Profile model is that everything in the User model will be used only for authentication while everything from the Profile model will be used by the business logic and in searches (the system will have a lot of them).

A Preferencies model (pointed by User) will be also added and will store user’s preferences and finally, the profile will be associated with AdvancedProfile (containing additional information about a profile) and Album (which will contain the pics).

The whole thing here is that I don’t have experience in this kind of problem and I would be very glad to read some insights and suggestions, in order to avoid problems or design errors that will be hard to fix later.

Is there any incorrect thing in this construction?

I would appreciate a lot any valuable suggestion you could provde.

turing completeness – How do we define the term “computation” across models of computation?

How do we define the term computation / computable function generically across models of computation?

Beginning with the textbook definitions of: {Linz, Sipser and Kozen} for “computable function”.

A function f with domain f is said to be Turing-computable of just computable if there exists some Turing machine M = (Q, Σ, Γ, δ, q0, □, F)
such that q0w ⊢* Mqₘf(w), qₘ ∈ F, for all w ∈ D (Linz:1990:243)

Computable Functions
A Turing machine computes a function by starting with the input to the function on the tape and halting with the output of the function on the tape. (Sipser:1997:190)

Definition 5.12
A function f: Σ* → Σ* is a computable function if some Turing machine M, on every input w, halts with just f(w) on its tape. (Sipser:1997:190)

A partial function σ: Σ* → Σ* is said to be a computable function if σ(x) = M(x) for some Turing machine M. (Kozen:1997:347)

I need to have the term computation / computable function defined generically across models of computation so that I can know whether or not a specific C function is a computation / computable function. I have a C function that uses static local data and some reviewers say that this does not count as a computation / computable function.

Linz, Peter 1990. An Introduction to Formal Languages and Automata. Lexington/Toronto: D. C. Heath and Company.

Sipser, Michael 1997. Introduction to the Theory of Computation. Boston: PWS Publishing Company

Kozen, Dexter 1997. Automata and Computability. New York: Springer-Verlag.

machine learning – Compare Hidden Markov Model’s sample with ground truth data

I have a time-serie and I fit different HMMs on it, each with a different number of hidden states.
Now after sampling from the models , I’d like to compare the results with the ground truth data and find the model that gets closer to the real world data in the original time-serie.

For now I simply compared visually the distribution of the values generated by the HMMs and the distribution of values in the time-serie, but I’d like to compute a number indicating which model generates better samples.

Are Norway’s prisons good models for the world? | Forum Promotion

Prisons in Norway are often considered as “models”. Norwegian prisons have acceptable standards for material conditions. Most prisoners have their own cell with a toilet and can share kitchens with other inmates. Yet, the overuse of solitary confinement is very problematic. What Prison Insider…

machine learning – Graph Neural Network models

I recently started self-learning about GNNs, and I have trouble understanding the difference between the GNN models.

As I understand it, all GNN models apply an aggregation step on each node, and the different models differ in the aggregation function.

  1. Is the aggregation for a single node done by aggregating the entire graph? or only its close neighbors?
  2. What is the difference between GraphSAGE and other GNN models? Do I understand correctly that GraphSAGE aggregates only some of a node’s neighbors and not all of them?

python – Django Models for an ESL school

I am working on building a management interface for an ESL (English as a Second Language) institute, basically it is a language school where people learn English.

I have prepared my models for each app and I really would like someone to review them and provide me with suggestions and possible mistakes in the design.

  • the models for an app called ez_core:
GENDER_CHOICES = (
    ('Female', 'Female'),
    ('Male', 'Male')
)

STREET_ADDRESS_CHOICES = (
    ('A', 'A'),
    ('B', 'B')
)

EDUCATIONAL_LEVEL_CHOICES = (
    ('Bachelor's Degree', 'Bachelor's Degree'),
    ('Master's Degree', 'Master's Degree'),
    ('PhD Degree', 'PhD Degree'),
)

CONTACT_RELATIONSHIP_CHOICES = (
    ('Brother', 'Brother'),
    ('Father', 'Father'),
    ('Mother', 'Mother'),
    ('Sister', 'Sister'),
    ('Uncle', 'Uncle'),
    ('Wife', 'Wife'),
)

MEDICAL_CONDITION_CHOICES = (
    ('Chronic Disease', 'Chronic Disease'),
    ('Allergies', 'Allergies')
)


class PersonalInfo(models.Model):
    full_name = models.CharField(max_length=100)
    phone_number = models.CharField(max_length=100)
    email_address = models.EmailField(max_length=100)
    birthdate = models.DateField()
    gender = models.CharField(max_length=6, choices=GENDER_CHOICES)
    personal_id_number = models.CharField(max_length=100)
    passport_number = models.CharField(max_length=100)
    personal_photo_link = models.CharField(max_length=100)
    id_card_attchment_link = models.CharField(max_length=100)
    passport_attachment_link = models.CharField(max_length=100)
    street_address = models.CharField(
        max_length=100, choices=STREET_ADDRESS_CHOICES)
    address_reference_point = models.CharField(max_length=100)
    educational_level = models.CharField(
        max_length=100, choices=EDUCATIONAL_LEVEL_CHOICES)
    specialization = models.CharField(max_length=100)
    contact_phone_number = models.CharField(max_length=100)
    contact_name = models.CharField(max_length=100)
    contact_relationship = models.CharField(
        max_length=100, choices=CONTACT_RELATIONSHIP_CHOICES)
    medical_condition = models.CharField(
        max_length=100, choices=MEDICAL_CONDITION_CHOICES)
    medication = models.CharField(max_length=100)

    class Meta:
        abstract = True
  • The models for an app called ez_course:
COURSE_TYPE_CHOICES = (
    ('Adults', 'Adults'),
    ('Kids', 'Kids')
)

COURSE_TITLE_CHOICES = (
    ('General English', 'General English'),
    ('Big English', 'Big English'),
    ('Supermind', 'Supermind'),
    ('Business', 'Business'),
    ('UK Visa', 'UK Visa'),
    ('IELTS', 'IELTS'),
)


class CourseDays(models.Model):
    date = models.DateField()


class Course(models.Model):
    course_type = models.CharField(max_length=100, choices=COURSE_TYPE_CHOICES)
    course_title = models.CharField(
        max_length=100, choices=COURSE_TITLE_CHOICES)
    course_description = models.TextField()
    course_start_time = models.TimeField()
    course_end_time = models.TimeField()
    # teachers
    course_cost = models.IntegerField()
    course_days = models.ManyToManyField(CourseDays)
  • The models for an app called ez_staff:
from ez_core.models import PersonalInfo
from ez_course.models import Course

POSITION_CHOICES = (
    ('Teacher Assistant', 'Teacher Assistant'),
    ('Volunteer', 'Volunteer'),
    ('Teacher', 'Teacher'),
    ('Service', 'Service'),
    ('Intern', 'Intern'),
    ('Admin', 'Admin'),
    ('Boss', 'Boss'),
)


class Staff(PersonalInfo):
    is_married = models.BooleanField(default=False)
    number_of_children = models.IntegerField()
    start_working_date = models.DateField()
    position = models.CharField(max_length=100, choices=POSITION_CHOICES)
    taught_courses = models.ManyToManyField(Course, blank=True)
    is_active = models.BooleanField(default=True)
    inactivity_reason = models.CharField(max_length=100, blank=True, null=True)
  • The models for an app called ez_student:
from ez_core.models import PersonalInfo
from ez_course.models import Course


class DailyAttendance(models.Model):
    date = models.DateField()
    first_hour = models.BooleanField(default=False)
    second_hour = models.BooleanField(default=False)
    leave = models.BooleanField(default=False)


class Test(models.Model):
    test_title = models.CharField(max_length=100)
    test_max_score = models.IntegerField()
    test_score = models.IntegerField()
    test_date = models.DateField()


class Student(PersonalInfo):
    has_bus_service = models.BooleanField(default=False)
    is_postponed = models.BooleanField(default=False)
    postpone_reason = models.CharField(max_length=100, blank=True, null=True)
    courses = models.ForeignKey(Course, on_delete=models.CASCADE)
    daily_attendance = models.ManyToManyField(
        DailyAttendance, blank=True)
    tests = models.ManyToManyField(Test)

seo – Is providing high quality 3D models in exchange for back links a white-hat link-building strategy?

Would you consider this a safe (white hat) link-building strategy?

Our company has built 3D interactive models of some ecommerce products.

We want to allow other sites to use these models in their own ecommerce stores, at no cost, so long as they provide a backlink to us.

Reasons I think it’s okay:

  • The 3D models are quality content, these were expensive to create, they’re unique, and they get high engagement from website visitors.

  • They’ll only be used on sites that are relevant to our industry

  • We will manually approve which sites can use these 3D models

Reasons I question if it’s okay:

  • There is an “exchange” happening. We provide the 3D model for them, they link back to us.

combinatorics – Formula to calculate the number of possible models with hierarchical structure

Please Note:
On the surface this question may appear like a statistics question, however I believe that it is a question related to combinatorics and therefore it is more suited in the math stack exchange.

Statement of Problem

I would like to calculate the number of possible candidate models I have given a set of covariates $x_1, ldots, x_p$. Each model has a hierarchical structure.

Initially the linear terms are considered. If a linear term is added to a model and considered significant, then it’s quadratic term and all two-way interaction terms are also considered (both quadratic and two-way interaction are considered together).

For example, consider a model with 2 covariates $x_1$ and $x_2$. The set of candidate models for the linear terms are:

Model 1: $y = beta_0$

Model 2: $y = beta_0 + beta_1x_1$

Model 3: $y = beta_0 + beta_2x_2$

Model 4: $y = beta_0 + beta_1x_1 + beta_2x_2$

If Model 1 or 2 are successful, then we have the following candidate models with quadratic terms:

Model 5: $y = beta_0 + beta_1x_1 + beta_{(1q)}x_1^2$

Model 6: $y = beta_0 + beta_2x_2 + beta_{(2q)}x_2^2$

If Model 4 is successful, then we have the following candidate models with quadratic and/or interaction terms:

Model 7: $y = beta_0 + beta_1x_1 + beta_2x_2 + beta_{(1q)}x_1^2$

Model 8: $y = beta_0 + beta_1x_1 + beta_2x_2 + beta_{(2q)}x_2^2$

Model 9: $y = beta_0 + beta_1x_1 + beta_2x_2 + beta_{(1q)}x_1^2 + beta_{(2q)}x_2^2$

Model 10: $y = beta_0 + beta_1x_1 + beta_2x_2 + beta_{(1q)}x_1^2 + beta_{12}x_1x_2$

Model 12: $y = beta_0 + beta_1x_1 + beta_2x_2 + beta_{(2q)}x_2^2 + beta_{12}x_1x_2$

Model 13: $y = beta_0 + beta_1x_1 + beta_2x_2 + beta_{(1q)}x_1^2 + beta_{(2q)}x_2^2 + beta_{12}x_1x_2$

When there are 2 possible covariate, we have 13 possible models. The list of candidate models gets larger as the number of covariates increases.

Is there a formula to calculate the number of candidate models for $p$ covariates that have this hierarchical structure?

machine learning – How to find the relation between two models, and sort of inductive bias is that is implemented in those models

I am pretty new with data science and Machine Learning. I am learning form one textbook and I found this task. I have no Idea from where to start and what relation could be. Any help would be great.

Suppose we want to learn the Boolean function in instance space
$X$={0,1}$^3$. We are given two models to examine: H1 is a set of all
logical functions in the conjunctive normal form (CNF), H2 is a set of
logical functions which can be displayed in Horner form (disjunction
of literals with at most one positive). I need to explain what is the
relation between H1 and H2, and which sort of inductive bias is
implemented in those models.

models – How can we generate 3D architecture in the background procedurally with respect/similar to the real world?

AFAIK they achieve this by

Parameterized Procedural Placement

They create a workflow where you create a handful assets in this case building floors and they procedurally tweak the parameters such as Floor count,size,tint and custom props such as air conditioning outside of the buildings.

I once a saw a video about ubisoft creating a procedural assasins creed city.They premade a bunch of houses and spread them randomly.

You should desing a workflow where you control how your building floors are stacked on each other and how each floor has its own specific unique props.

This is what i would do

  • I would decide what a building floor means to me.These would be my parameters: IsGroundFloor?, width and height of the floor, how many windows, a balcony?, general tint color of the floor material and unique set of models.(Such as vegatation, flowers, air conditioning or a satallite dish perhaps?).
  • I would decide how many floors should a building has.Define the minimum and the maximum
  • I would decide what will be the floor independent objects such as fire escape ladder which starts from ground to the top of the building, some garden? or fences?

with these parameters one can create wide range of different buildings considering you feed your procedural workflow with enough assets