Giter Club home page Giter Club logo

Comments (14)

gustavdelius avatar gustavdelius commented on July 21, 2024

Some background to this: core mizer was always set up to allow any species to be caught by an arbitrary number of gears, however the user would need to set the selectivity and catchability arrays in the MizerParams object by hand, because the MizerParams() setup function only allowed one gear per species. This proposal would make it easier to set up multiple gears per species.

The data frame described by Mike would be passed to the function setFishing() via a new gear_params data frame. After the function has used the information from the data frame to set up the selectivity and catchability arrays, we could store the data frame in the params object, as we do for the species_params data frame, or we could discard it. What do you think would be better.

from mizer.

juliablanchard avatar juliablanchard commented on July 21, 2024

I agree having the flexibility for multiple gears per species has been missing and is really needed. Might also be worth checking in with @camillanovaglio who has been working on multiple (and overlappping) fleets to see how she has been doing this

from mizer.

camillanovaglio avatar camillanovaglio commented on July 21, 2024

Hi all, I apologise for the lengthy response. Lost to say. Happy to move this to an email conversation if best.

Just as a note, in my version of the model fleets can target multiple specie and each fleet is driven by economic factors (profit) so that model forcing are species-specific prices and fleet-specific costs instead of effort. I haven’t fully implemented and tested the in-between level where model forcing are fleet-specific effort values. But a couple of colleagues I am working with on the development of Mizer models for different systems and their use to answer fisheries management questions would like to use this version. So, my plan is to test it soon (and this conversation is great).

I used a similar approach to the one discussed here. I grouped Mike’s inputs into 2 objects: a fleet X species matrix (catchability) specifying which species each fleets targets and by how much – i.e. 0 if the species is not a target of the fleet and 1 if the species is fully accessible to the fleet, similar to the interaction matrix; and a df (selectivity_params) that specifies the gear, selectivity function and params for each species and fleet combination (please see below).

I pass both selectivity_params and catchability to MizerParams() and store them in the params object. catchability will be used in project to calculate mortalities, but selectivity_params could actually be discarded once used in this function. When setting res@selectivity in MizerParams() the for loops are by fleet and by species (instead of by gear/fleet only, I think).

selectivity_params example. The ‘gear’ field calls the selectivity function as in the original Mizer. Options are knife edge, sigmoid (called trawl) and bell-shaped (called gillnet)
subfleet species gear param_name param_value
1 SSG centroberyx affinis gillnet W25_S 165.90832
2 SSG seriolella brama gillnet W25_S 216.44249
3 SSG genypterus blacodes gillnet W25_S 1714.26800

Catchability example.
centroberyx affinis galeorhinus galeus genypterus blacodes helicolenus barathri
SED 0.0001980472 0.0001508034 0.002055938 0
SET-DS 0.0000000000 0.0000000000 0.017267002 0
SET-SH 0.2227905060 0.0024284621 0.068479466 0
SET-US 0.0764004775 0.0044350325 0.902269349 0
SSG 0.0006109693 0.0929857021 0.009928245 0

Inside project(), the main changes relate to the effort matrix (time X fleet), the calculation of fishing mortality for each species targeted by multiple fleets, and of yield by fleet. Fishing mortality for each species is calculated as the sum of mortalities from each fleet targeting the species. So first at fleet level: Fmort_fleet = effort (cost) * Q (catchability) * selectivity (selectivity_params). Fmort_fleet is also used to calculate yield by fleet.

Happy to discuss more and collaborate on this, Cami

from mizer.

gustavdelius avatar gustavdelius commented on July 21, 2024

Thank you for that very informative post. This issue tracker is exactly the right place for such in-depth discussions of features.

If I understand correctly, what you call "fleet" is exactly the same as what mizer misleadingly calls "gear", namely something that catches multiple species with possibly different selectivity curves for each species, and for which a time-dependent effort can be specified. You calculate the fishing mortality the same way as mizer currently does, see https://sizespectrum.org/mizer/dev/reference/MizerParams.html#setting-fishing , just with the sum over gears being a sum over fleets. Please tell me if I misunderstood.

You and @michaelspence have a slightly different proposal for how to specify the parameters needed to set up the selectivity array and the catchability matrix. The two main differences are:

  1. In your proposal the user specifies the catchability matrix directly (albeit as a data frame, but that does not make any difference), whereas in Mike's proposal that information is included in the data frame.
  2. In your proposal there is one column for the parameter names and one for the parameter values, and then one row in the data frame for each parameter for each gear/fleet and species. In Mike's proposal there is one column for each parameter name, holding the value of that parameter. Mike's proposal leads to many NAs in the data frame because not all parameters are used by all selectivity curves.

Personally I think your proposal is the more elegant (and I should admit that I am responsible for the inelegance in Mike's proposal that we came up with together during a bus ride).

I also prefer your term "fleet" to mizer's current term "gear".

When implementing the new way of setting up the selectivity and catchability arrays, please keep the old way around for backwards compatibility. In the documentation we will however indicate that it is deprecated.

from mizer.

michaelspence avatar michaelspence commented on July 21, 2024

Hi All,

How would the "selectivity_params" data frame look if you chose a selectivity curve with more than one parameter, e.g. the sigmoid_length function? Also, what would that look like if you had some fleets/species with selectivity curves with different numbers of parameters, e.g. some with knife-edge and others with sigmoid?

I also prefer the term "fleet" rather than "gear".

Cheers
Mike

from mizer.

gustavdelius avatar gustavdelius commented on July 21, 2024

@michaelspence , here is an example that may help with your question.

selectivity_params <- tribble(
    ~fleet,    ~species,              ~sel_func,        ~param_name,        ~param_value,
    "fleet 1", "centroberyx affinis", "knife_edge",     "knife_edge_size",  165,
    "fleet 1", "seriolella brama",    "sigmoid_weight", "sigmoidal_weight", 24,
    "fleet 1", "seriolella brama",    "sigmoid_weight", "sigmoidal_sigma",  3,
    "fleet 2", "seriolella brama",    "knife_edge",     "knife_edge_size",  170
)

Fleet 1 fishes with different selectivity functions on two species and there are two parameters needed for the sigmoid_weight function, hence there are two rows in the data frame for this.

from mizer.

gustavdelius avatar gustavdelius commented on July 21, 2024

@camillanovaglio , here is the spreadsheet the user would need to provide in Mike's proposal to implement the example from my previous post.

fleet species catchability sel_func knife_edge_size sigmoidal_weight sigmoidal_sigma
fleet 1 centroberyx affinis 0.9 knife_edge 165
fleet 1 seriolella brama 0.5 sigmoid_weight 24 3
fleet 2 seriolella brama 1 knife_edge 178

The advantage over your proposal is that everything is in one spreadsheet and that there is only one row for each fleet - species pair. The disadvantage is that the parameter columns are only partially filled.

I now let you and Mike fight it out. The main criterion should be what is more natural for the user to set up. You are closer to the users than me.

from mizer.

camillanovaglio avatar camillanovaglio commented on July 21, 2024

@michaelspence @gustavdelius I think MIke's table for selectivity is best. Mine is the same but after a gather(), which I could have called inside MIzerParams(). And, I do have lots of NAs too. It seems more intuitive for the user to fill in selectivity info for each fleet-species combinations by columns.

I am not sure what the 'selectivity' column in the table above is. Should that be catchability? In my experience it is better to have a separate fleet by species matrix/df with catchabilities only. This is because catchabilities are most often key parameters that need tuning/calibration, and it's handy to have them on a separate file and to be able to clearly compare values across fleets and species while tuning.

I like fleets better than gears too. Right now fleets and gears have the same meaning, but a further extension might be multi-fleet and multi-gear, where each fleet (e.g. the pelagic fishing fleet) can 'choose' to use different gears (e.g. longline or pelagic trawl). This is actually similar to fleet and sel_function in the table above. Instead, in my version each fleet (e.g. the trawling fleet) uses one gear (trawl) characterised by one selectivity function (sigmoid_weight). I think sel_function should be gear-specific.

I saw that this issue is closed - how do we go from here? Should I keep working on my version and keep you updated on any progress while you implement this in Mizer?

Cheers, Cami

from mizer.

gustavdelius avatar gustavdelius commented on July 21, 2024

@camillanovaglio , you are right, the column heading in the example table should have been "catchability". I have now corrected that.

I am not yet convinced that every user will want to set up two separate spreadsheets. This may be useful for some users with complicated setups, but for simpler cases it would be an unnecessary complication. However I am not opposed to giving the user the option of either including the catchability in the single data frame or to provide it separately in a second data frame.

Let us not put the extension to several gears per fleet into core mizer. This could be a mizer extension in the future.

This issue is not closed. I closed the corresponding issue on my fork in order to concentrate the discussion onto this issue here, and GitHub displayed that event in a somewhat confusing fashion.

As to how to progress this: perhaps the best would be for each of you to look at the other's code and then one of you to take the lead to combine the best bits of each and integrate them into mizer. The code should go into the setFishing() function in mizer.

from mizer.

camillanovaglio avatar camillanovaglio commented on July 21, 2024

Sounds all good, having one file with all fishing parameters makes things simpler. Though I do like your second option too.

My codes are in camillanovaglio/mizer-fleet (messy).

from mizer.

gustavdelius avatar gustavdelius commented on July 21, 2024

Yes, I think we should keep all three options for setting the fishing:

  1. Via columns in the species_params dataframe, as currently. This restricts to at most one gear per species.
  2. Via a single fleet_params dataframe, as proposed by Mike
  3. Via two dataframes. as proposed by you.

Which method is used will depend on what the user passes to the setFishing() function.

from mizer.

gustavdelius avatar gustavdelius commented on July 21, 2024

Besides adding code to setFishing(), we should also reword all mention of "gear" in the vignettes and in the documentation to refer to "fleet" instead.

from mizer.

gustavdelius avatar gustavdelius commented on July 21, 2024

@michaelspence and @camillanovaglio, have you done further work on this? Mariella and I are going to give a mizer course in Santiago, Chile next week and it would be nice if we could already teach them the new way of setting fleet parameters.

from mizer.

gustavdelius avatar gustavdelius commented on July 21, 2024

I have now implemented this via a new slot @gear_params in the MizerParams class. See https://sizespectrum.org/mizer/dev/reference/setFishing.html#setting-fishing. Thanks go to @camillanovaglio and @michaelspence for pushing for this and providing code. I used their code for inspiration.

from mizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.